2015-04-10 14:48:38 +00:00
|
|
|
-- ---------------------------------------------------------
|
|
|
|
-- This file is the Codepot database schema file for MySQL.
|
|
|
|
-- Note this file doesn't mandate which database to use.
|
|
|
|
-- ---------------------------------------------------------
|
2010-01-24 14:34:03 +00:00
|
|
|
|
2010-02-19 09:27:33 +00:00
|
|
|
CREATE TABLE site (
|
|
|
|
id VARCHAR(32) PRIMARY KEY,
|
|
|
|
name VARCHAR(128) NOT NULL,
|
2015-04-25 04:43:38 +00:00
|
|
|
summary VARCHAR(255) NOT NULL,
|
2010-02-19 09:27:33 +00:00
|
|
|
text TEXT NOT NULL,
|
|
|
|
|
2011-07-21 14:23:25 +00:00
|
|
|
createdon DATETIME NOT NULL,
|
|
|
|
updatedon DATETIME NOT NULL,
|
|
|
|
createdby VARCHAR(32) NOT NULL,
|
|
|
|
updatedby VARCHAR(32) NOT NULL
|
2010-02-19 09:27:33 +00:00
|
|
|
) charset=utf8 engine=InnoDB;
|
|
|
|
|
2010-01-24 14:34:03 +00:00
|
|
|
CREATE TABLE project (
|
2015-04-29 02:36:41 +00:00
|
|
|
id VARCHAR(32) PRIMARY KEY,
|
|
|
|
name VARCHAR(255) UNIQUE NOT NULL,
|
|
|
|
summary VARCHAR(255) NOT NULL,
|
|
|
|
description TEXT NOT NULL,
|
|
|
|
commitable CHAR(1) NOT NULL DEFAULT 'Y',
|
|
|
|
public CHAR(1) NOT NULL DEFAULT 'Y',
|
|
|
|
|
|
|
|
createdon DATETIME NOT NULL,
|
|
|
|
updatedon DATETIME NOT NULL,
|
|
|
|
createdby VARCHAR(32) NOT NULL,
|
|
|
|
updatedby VARCHAR(32) NOT NULL
|
2010-01-24 14:34:03 +00:00
|
|
|
|
|
|
|
) 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,
|
2014-05-15 16:17:21 +00:00
|
|
|
text TEXT NOT NULL,
|
2015-03-26 05:52:21 +00:00
|
|
|
columns INT NOT NULL DEFAULT 1,
|
2010-01-24 14:34:03 +00:00
|
|
|
|
2011-07-21 14:23:25 +00:00
|
|
|
createdon DATETIME NOT NULL,
|
|
|
|
updatedon DATETIME NOT NULL,
|
|
|
|
createdby VARCHAR(32) NOT NULL,
|
|
|
|
updatedby VARCHAR(32) NOT NULL,
|
2010-01-24 14:34:03 +00:00
|
|
|
|
|
|
|
UNIQUE KEY wiki_id (projectid, name),
|
|
|
|
|
|
|
|
CONSTRAINT wiki_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
|
|
|
ON DELETE RESTRICT ON UPDATE CASCADE
|
2015-03-25 07:29:18 +00:00
|
|
|
) charset=utf8 engine=InnoDB;
|
2010-01-24 14:34:03 +00:00
|
|
|
|
2010-04-27 14:56:11 +00:00
|
|
|
CREATE TABLE wiki_attachment (
|
|
|
|
projectid VARCHAR(32) NOT NULL,
|
|
|
|
wikiname VARCHAR(255) NOT NULL,
|
|
|
|
name VARCHAR(255) NOT NULL,
|
|
|
|
encname VARCHAR(255) NOT NULL,
|
|
|
|
|
2011-07-21 14:23:25 +00:00
|
|
|
createdon DATETIME NOT NULL,
|
|
|
|
createdby VARCHAR(32) NOT NULL,
|
2010-04-27 14:56:11 +00:00
|
|
|
|
|
|
|
UNIQUE KEY wiki_attachment_id (projectid, wikiname, name),
|
|
|
|
|
|
|
|
CONSTRAINT wiki_attachment_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
|
|
|
ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
|
|
|
|
|
|
CONSTRAINT wiki_attachment_wikiid FOREIGN KEY (projectid,wikiname) REFERENCES wiki(projectid,name)
|
|
|
|
ON DELETE RESTRICT ON UPDATE CASCADE
|
2015-01-29 13:48:35 +00:00
|
|
|
) charset=utf8 engine=InnoDB;
|
2010-04-27 14:56:11 +00:00
|
|
|
|
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,
|
2010-03-16 15:11:59 +00:00
|
|
|
description TEXT NOT NULL,
|
|
|
|
|
2010-03-08 13:51:36 +00:00
|
|
|
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
|
|
|
|
2011-07-21 14:23:25 +00:00
|
|
|
createdon DATETIME NOT NULL,
|
|
|
|
updatedon DATETIME NOT NULL,
|
|
|
|
createdby VARCHAR(32) NOT NULL,
|
|
|
|
updatedby VARCHAR(32) NOT NULL,
|
2010-03-08 13:51:36 +00:00
|
|
|
|
|
|
|
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
|
2015-01-29 13:48:35 +00:00
|
|
|
) charset=utf8 engine=InnoDB;
|
2010-01-24 14:34:03 +00:00
|
|
|
|
2015-02-12 16:51:18 +00:00
|
|
|
CREATE TABLE issue_attachment (
|
|
|
|
projectid VARCHAR(32) NOT NULL,
|
|
|
|
issueid BIGINT NOT NULL,
|
|
|
|
name VARCHAR(255) NOT NULL,
|
|
|
|
encname VARCHAR(255) NOT NULL,
|
|
|
|
|
|
|
|
createdon DATETIME NOT NULL,
|
|
|
|
createdby VARCHAR(32) NOT NULL,
|
|
|
|
|
|
|
|
UNIQUE KEY issue_attachment_id (projectid, issueid, name),
|
|
|
|
|
|
|
|
CONSTRAINT issue_attachment_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
|
|
|
ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
|
|
|
|
|
|
CONSTRAINT issue_attachment_issueid FOREIGN KEY (projectid,issueid) REFERENCES issue(projectid,id)
|
|
|
|
ON DELETE RESTRICT ON UPDATE CASCADE
|
|
|
|
) charset=utf8 engine=InnoDB;
|
|
|
|
|
2010-03-16 15:11:59 +00:00
|
|
|
CREATE TABLE issue_change (
|
2015-04-29 02:36:41 +00:00
|
|
|
projectid VARCHAR(32) NOT NULL,
|
|
|
|
id BIGINT NOT NULL,
|
|
|
|
sno BIGINT NOT NULL,
|
2015-01-29 13:48:35 +00:00
|
|
|
|
2015-04-29 02:36:41 +00:00
|
|
|
type VARCHAR(32) NOT NULL,
|
|
|
|
status VARCHAR(32) NOT NULL,
|
|
|
|
owner VARCHAR(255) NOT NULL,
|
|
|
|
priority VARCHAR(32) NOT NULL,
|
2015-04-29 14:31:15 +00:00
|
|
|
comment TEXT NOT NULL,
|
2010-03-16 15:11:59 +00:00
|
|
|
|
2015-04-29 02:36:41 +00:00
|
|
|
updatedon DATETIME NOT NULL,
|
|
|
|
updatedby VARCHAR(32) NOT NULL,
|
2010-03-16 15:11:59 +00:00
|
|
|
|
|
|
|
PRIMARY KEY (projectid, id, sno),
|
|
|
|
KEY issue_update_time (projectid, id, updatedon),
|
|
|
|
|
|
|
|
CONSTRAINT issue_update_id FOREIGN KEY (projectid,id) REFERENCES issue(projectid,id)
|
|
|
|
ON DELETE RESTRICT ON UPDATE CASCADE
|
|
|
|
|
|
|
|
) charset=utf8 engine=InnoDB;
|
2015-02-12 16:51:18 +00:00
|
|
|
|
|
|
|
CREATE TABLE issue_change_attachment (
|
|
|
|
projectid VARCHAR(32) NOT NULL,
|
|
|
|
issueid BIGINT NOT NULL,
|
|
|
|
issuesno BIGINT NOT NULL,
|
|
|
|
name VARCHAR(255) NOT NULL,
|
|
|
|
encname VARCHAR(255) NOT NULL,
|
|
|
|
|
|
|
|
createdon DATETIME NOT NULL,
|
|
|
|
createdby VARCHAR(32) NOT NULL,
|
|
|
|
|
|
|
|
UNIQUE KEY issue_change_attachment_id (projectid, issueid, name),
|
|
|
|
|
|
|
|
CONSTRAINT issue_change_attachment_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
|
|
|
ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
|
|
|
|
|
|
CONSTRAINT issue_change_attachment_issueidsno FOREIGN KEY (projectid,issueid,issuesno) REFERENCES issue_change(projectid,id,sno)
|
|
|
|
ON DELETE RESTRICT ON UPDATE CASCADE
|
|
|
|
) charset=utf8 engine=InnoDB;
|
2010-03-16 15:11:59 +00:00
|
|
|
|
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,
|
|
|
|
|
2011-07-21 14:23:25 +00:00
|
|
|
createdon DATETIME NOT NULL,
|
|
|
|
updatedon DATETIME NOT NULL,
|
|
|
|
createdby VARCHAR(32) NOT NULL,
|
|
|
|
updatedby VARCHAR(32) NOT NULL,
|
2010-01-24 14:34:03 +00:00
|
|
|
|
|
|
|
UNIQUE KEY file_id (projectid, name),
|
|
|
|
UNIQUE KEY (encname),
|
2015-04-28 05:12:06 +00:00
|
|
|
INDEX file_tagged_name (projectid, tag, name),
|
2010-01-24 14:34:03 +00:00
|
|
|
|
2014-06-24 13:52:05 +00:00
|
|
|
CONSTRAINT file_projectid FOREIGN KEY (projectid) REFERENCES project(id)
|
2010-01-24 14:34:03 +00:00
|
|
|
ON DELETE RESTRICT ON UPDATE CASCADE
|
2015-01-29 13:48:35 +00:00
|
|
|
) charset=utf8 engine=InnoDB;
|
2010-01-24 14:34:03 +00:00
|
|
|
|
2015-04-28 05:12:06 +00:00
|
|
|
CREATE TABLE code_review (
|
2015-04-29 02:36:41 +00:00
|
|
|
projectid VARCHAR(32) NOT NULL,
|
|
|
|
rev BIGINT NOT NULL,
|
|
|
|
sno BIGINT NOT NULL,
|
2015-04-29 14:31:15 +00:00
|
|
|
comment TEXT NOT NULL,
|
2015-04-28 05:12:06 +00:00
|
|
|
|
2015-04-29 02:36:41 +00:00
|
|
|
createdon DATETIME NOT NULL,
|
|
|
|
createdby VARCHAR(32) NOT NULL,
|
2015-04-28 05:12:06 +00:00
|
|
|
|
2015-04-29 02:36:41 +00:00
|
|
|
updatedon DATETIME NOT NULL,
|
|
|
|
updatedby VARCHAR(32) NOT NULL,
|
2015-04-28 05:12:06 +00:00
|
|
|
|
|
|
|
UNIQUE KEY code_review_id (projectid, rev, sno),
|
|
|
|
|
|
|
|
CONSTRAINT code_review_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)
|
2015-01-29 13:48:35 +00:00
|
|
|
) charset=utf8 engine=InnoDB;
|
2010-05-18 14:12:52 +00:00
|
|
|
|
|
|
|
CREATE TABLE user_settings (
|
|
|
|
userid VARCHAR(32) PRIMARY KEY,
|
2014-06-24 13:52:05 +00:00
|
|
|
code_hide_line_num CHAR(1) NOT NULL,
|
2015-04-17 04:02:42 +00:00
|
|
|
code_hide_metadata CHAR(1) NOT NULL,
|
2014-06-24 13:52:05 +00:00
|
|
|
icon_name VARCHAR(255) UNIQUE NULL
|
2010-05-18 14:12:52 +00:00
|
|
|
) charset=utf8 engine=InnoDB;
|
2011-11-26 13:32:03 +00:00
|
|
|
|
2015-04-29 14:31:15 +00:00
|
|
|
CREATE TABLE user_account (
|
2011-11-26 13:32:03 +00:00
|
|
|
userid VARCHAR(32) PRIMARY KEY,
|
|
|
|
passwd VARCHAR(255) NOT NULL,
|
|
|
|
email VARCHAR(255),
|
|
|
|
enabled CHAR(1) NOT NULL DEFAULT 'N' CHECK(enabled in ('Y', 'N'))
|
|
|
|
) charset=utf8 engine=InnoDB;
|
2015-01-29 13:48:35 +00:00
|
|
|
|