2010-01-24 14:34:03 +00:00
|
|
|
|
|
|
|
USE codepot;
|
|
|
|
|
2010-02-19 09:27:33 +00:00
|
|
|
CREATE TABLE site (
|
|
|
|
id VARCHAR(32) PRIMARY KEY,
|
|
|
|
name VARCHAR(128) NOT NULL,
|
|
|
|
text TEXT NOT NULL,
|
|
|
|
|
|
|
|
createdon DATETIME,
|
|
|
|
updatedon DATETIME,
|
|
|
|
createdby VARCHAR(32),
|
|
|
|
updatedby VARCHAR(32)
|
|
|
|
) charset=utf8 engine=InnoDB;
|
|
|
|
|
2010-01-24 14:34:03 +00:00
|
|
|
CREATE TABLE project (
|
|
|
|
id VARCHAR(32) PRIMARY KEY,
|
|
|
|
name VARCHAR(255) UNIQUE NOT NULL,
|
|
|
|
summary VARCHAR(255) NOT NULL,
|
|
|
|
description TEXT NOT NULL,
|
|
|
|
|
|
|
|
createdon DATETIME,
|
|
|
|
updatedon DATETIME,
|
|
|
|
createdby VARCHAR(32),
|
|
|
|
updatedby VARCHAR(32)
|
|
|
|
|
|
|
|
) charset=utf8 engine=InnoDB;
|
|
|
|
|
|
|
|
CREATE TABLE project_membership (
|
|
|
|
projectid VARCHAR(32) NOT NULL,
|
|
|
|
userid VARCHAR(32) NOT NULL,
|
|
|
|
priority INTEGER NOT NULL,
|
|
|
|
UNIQUE KEY membership (projectid, userid),
|
|
|
|
CONSTRAINT membership_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
|
|
|
ON DELETE CASCADE ON UPDATE CASCADE
|
|
|
|
) charset=utf8 engine=InnoDB;
|
|
|
|
|
|
|
|
CREATE TABLE wiki (
|
|
|
|
projectid VARCHAR(32) NOT NULL,
|
|
|
|
name VARCHAR(255) NOT NULL,
|
|
|
|
text TEXT NOT NULL,
|
|
|
|
|
|
|
|
createdon DATETIME,
|
|
|
|
updatedon DATETIME,
|
|
|
|
createdby VARCHAR(32),
|
|
|
|
updatedby VARCHAR(32),
|
|
|
|
|
|
|
|
UNIQUE KEY wiki_id (projectid, name),
|
|
|
|
|
|
|
|
CONSTRAINT wiki_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
|
|
|
ON DELETE RESTRICT ON UPDATE CASCADE
|
|
|
|
) charset=utf8 engine=InnoDB;
|
|
|
|
|
2010-03-08 13:51:36 +00:00
|
|
|
CREATE TABLE issue (
|
|
|
|
projectid VARCHAR(32) NOT NULL,
|
|
|
|
id BIGINT NOT NULL,
|
|
|
|
summary VARCHAR(255) NOT NULL,
|
|
|
|
type VARCHAR(32) NOT NULL,
|
|
|
|
status VARCHAR(32) NOT NULL,
|
2010-03-10 13:48:48 +00:00
|
|
|
owner VARCHAR(255) NOT NULL,
|
|
|
|
priority VARCHAR(32) NOT NULL,
|
2010-03-08 13:51:36 +00:00
|
|
|
description TEXT NOT NULL,
|
|
|
|
|
|
|
|
createdon DATETIME,
|
|
|
|
updatedon DATETIME,
|
|
|
|
createdby VARCHAR(32),
|
|
|
|
updatedby VARCHAR(32),
|
|
|
|
|
|
|
|
PRIMARY KEY (projectid, id),
|
2010-03-10 13:48:48 +00:00
|
|
|
KEY issue_status_type_summary (projectid, status, type, summary),
|
|
|
|
KEY issue_summary (projectid, summary),
|
2010-03-08 13:51:36 +00:00
|
|
|
|
|
|
|
CONSTRAINT issue_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
|
|
|
ON DELETE RESTRICT ON UPDATE CASCADE
|
|
|
|
) charset=utf8 engine=InnoDB;
|
2010-01-24 14:34:03 +00:00
|
|
|
|
|
|
|
CREATE TABLE file (
|
|
|
|
projectid VARCHAR(32) NOT NULL,
|
|
|
|
name VARCHAR(255) NOT NULL,
|
|
|
|
encname VARCHAR(255) NOT NULL,
|
|
|
|
tag VARCHAR(54) NOT NULL,
|
|
|
|
summary VARCHAR(255) NOT NULL,
|
|
|
|
md5sum CHAR(32) NOT NULL,
|
|
|
|
description TEXT NOT NULL,
|
|
|
|
|
|
|
|
createdon DATETIME,
|
|
|
|
updatedon DATETIME,
|
|
|
|
createdby VARCHAR(32),
|
|
|
|
updatedby VARCHAR(32),
|
|
|
|
|
|
|
|
UNIQUE KEY file_id (projectid, name),
|
|
|
|
UNIQUE KEY (encname),
|
|
|
|
INDEX tagged_file_id (projectid, tag, name),
|
|
|
|
|
|
|
|
CONSTRAINT file_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
|
|
|
ON DELETE RESTRICT ON UPDATE CASCADE
|
|
|
|
) charset=utf8 engine=InnoDB;
|
|
|
|
|
2010-02-19 12:03:51 +00:00
|
|
|
CREATE TABLE log (
|
|
|
|
id BIGINT PRIMARY KEY AUTO_INCREMENT,
|
2010-02-26 14:41:56 +00:00
|
|
|
projectid VARCHAR(32) NOT NULL,
|
2010-02-28 13:36:29 +00:00
|
|
|
type VARCHAR(16) NOT NULL,
|
|
|
|
action VARCHAR(16) NOT NULL,
|
|
|
|
userid VARCHAR(32) NOT NULL,
|
2010-02-19 12:03:51 +00:00
|
|
|
message TEXT NOT NULL,
|
|
|
|
createdon DATETIME NOT NULL,
|
2010-02-28 13:36:29 +00:00
|
|
|
INDEX timed_project_type_action (createdon, projectid, type, action)
|
2010-02-19 12:03:51 +00:00
|
|
|
) charset=utf8 engine=InnoDB;
|