codepot/codepot/etc/codepot.sql

108 lines
3.0 KiB
MySQL
Raw Normal View History

2010-01-24 14:34:03 +00:00
USE codepot;
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;
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,
owner VARCHAR(255) NOT NULL,
priority VARCHAR(32) NOT NULL,
description TEXT NOT NULL,
createdon DATETIME,
updatedon DATETIME,
createdby VARCHAR(32),
updatedby VARCHAR(32),
PRIMARY KEY (projectid, id),
KEY issue_status_type_summary (projectid, status, type, summary),
KEY issue_summary (projectid, summary),
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;
CREATE TABLE log (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
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,
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)
) charset=utf8 engine=InnoDB;