dropped the encname column from the file table

updated database schema files
This commit is contained in:
hyung-hwan 2015-09-07 01:07:44 +00:00
parent fbbecb6162
commit ac00c36910
5 changed files with 42 additions and 16 deletions

View File

@ -20,6 +20,7 @@ UPGRADING FROM 0.2.0
mysql> INSERT INTO file_list (projectid, name, filename, encname, md5sum, description) SELECT projectid, name, name, encname, md5sum, summary FROM file WHERE md5sum != '';
mysql> ALTER TABLE file DROP COLUMN summary;
mysql> ALTER TABLE file DROP COLUMN md5sum;
mysql> ALTER TABLE file DROP COLUMN encname;
INSTALLATION ON CENTOS

View File

@ -160,10 +160,7 @@ CREATE TABLE issue_change_attachment (
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 NOT NULL,

View File

@ -145,24 +145,34 @@ CREATE TABLE "cpot_issue_change_attachment" (
);
CREATE TABLE "cpot_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" CLOB NOT NULL,
"projectid" VARCHAR(32) NOT NULL,
"name" VARCHAR(255) NOT NULL,
"tag" VARCHAR(54) NOT NULL,
"description" CLOB NOT NULL,
"createdon" TIMESTAMP NOT NULL,
"updatedon" TIMESTAMP NOT NULL,
"createdby" VARCHAR(32) NOT NULL,
"updatedby" VARCHAR(32) NOT NULL,
UNIQUE ("projectid", "name"),
UNIQUE ("encname"),
CONSTRAINT file_projectid FOREIGN KEY ("projectid") REFERENCES "cpot_project"("id")
);
CREATE INDEX cpot_file_index_1 ON "cpot_file"("projectid", "tag", "name");
CREATE TABLE "cpot_file_list" (
"projectid" VARCHAR(32) NOT NULL,
"name" VARCHAR(255) NOT NULL,
"filename" VARCHAR(255) NOT NULL,
"encname" VARCHAR(255) NOT NULL,
"md5sum" CHAR(32) NOT NULL,
"description" CLOB NOT NULL,
UNIQUE ("projectid", "filename"),
UNIQUE ("encname"),
CONSTRAINT file_list_projectid FOREIGN KEY ("projectid","name") REFERENCES "cpot_file"("projectid","name")
);
CREATE INDEX cpot_file_list_index_1 ON "cpot_file_list"("projectid", "name");
CREATE TABLE "cpot_code_review" (
"projectid" VARCHAR(32) NOT NULL,
"rev" NUMBER(20,0) NOT NULL,
@ -242,3 +252,9 @@ BEGIN
UPDATE "cpot_issue_change_attachment" SET "issuesno" = :new."sno" WHERE "projectid" = :old."projectid" AND "issueid" = :old."id" AND "issuesno" = :old."sno";
END;
/
CREATE OR REPLACE TRIGGER cpot_upon_file_name_update AFTER UPDATE OF "name" ON "cpot_file" FOR EACH ROW
BEGIN
UPDATE "cpot_file_list" SET "name" = :new."name" WHERE "projectid" = :old."projectid" AND "name" = :old."name";
END;
/

View File

@ -179,10 +179,7 @@ CREATE TABLE issue_change_attachment (
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 TIMESTAMP NOT NULL,
@ -191,7 +188,6 @@ CREATE TABLE file (
updatedby VARCHAR(32) NOT NULL,
UNIQUE (projectid, name),
UNIQUE (encname),
CONSTRAINT file_projectid FOREIGN KEY (projectid) REFERENCES project(id)
ON DELETE RESTRICT ON UPDATE CASCADE
@ -199,6 +195,23 @@ CREATE TABLE file (
CREATE INDEX file_index_1 ON file(projectid, tag, name);
CREATE TABLE file_list (
projectid VARCHAR(32) NOT NULL,
name VARCHAR(255) NOT NULL,
filename VARCHAR(255) NOT NULL,
encname VARCHAR(255) NOT NULL,
md5sum CHAR(32) NOT NULL,
description VARCHAR(255) NOT NULL,
UNIQUE (projectid, filename),
UNIQUE (encname),
CONSTRAINT file_list_projectid FOREIGN KEY (projectid,name) REFERENCES file(projectid,name)
ON DELETE RESTRICT ON UPDATE CASCADE
);
CREATE INDEX file_list_index_1 ON file(projectid, name);
CREATE TABLE code_review (
projectid VARCHAR(32) NOT NULL,
rev BIGINT NOT NULL,

View File

@ -251,7 +251,6 @@ class FileModel extends Model
$this->db->set ('projectid', $projectid);
$this->db->set ('name', $name);
$this->db->set ('encname', '');
$this->db->set ('tag', $tag);
$this->db->set ('description', $description);
$this->db->set ('createdon', date('Y-m-d H:i:s'));