Skip to content
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.

Commit

Permalink
SQL upgrade routine
Browse files Browse the repository at this point in the history
  • Loading branch information
mutec committed Aug 3, 2017
1 parent 6ccbd59 commit 66c60d5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 46 deletions.
58 changes: 18 additions & 40 deletions install.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ CREATE TABLE wcf1_todo (
username VARCHAR(255) NOT NULL DEFAULT '',
time INT(10) NOT NULL DEFAULT 0,
endTime INT(10) NOT NULL DEFAULT 0,
private INT(1) NOT NULL DEFAULT 0,
comments INT(1) NOT NULL DEFAULT 1,
private TINYINT(1) NOT NULL DEFAULT 0, -- update
comments INT(1) NOT NULL DEFAULT 0, -- update
important INT(1) NOT NULL DEFAULT 0,
categoryID INT(10),
updatetimestamp INT(10) NOT NULL DEFAULT 0,
Expand All @@ -26,12 +26,12 @@ CREATE TABLE wcf1_todo (
cumulativeLikes MEDIUMINT(7) NOT NULL DEFAULT 0,
attachments MEDIUMINT(7) NOT NULL DEFAULT 0,
hasEmbeddedObjects TINYINT(1) NOT NULL DEFAULT 0,
notesHasEmbeddedObjects TINYINT(1) NOT NULL DEFAULT 0,
notesHasEmbeddedObjects TINYINT(1) NOT NULL DEFAULT 0, -- create
ipAddress VARCHAR(39) NOT NULL DEFAULT '',

-- 170404
hasLabels TINYINT(1) NOT NULL DEFAULT 0,
enableHtml TINYINT(1) NOT NULL DEFAULT 0,
enableHtml TINYINT(1) NOT NULL DEFAULT 0, -- update

PRIMARY KEY (todoID)
);
Expand Down Expand Up @@ -65,44 +65,22 @@ CREATE TABLE wcf1_todo_to_group (
PRIMARY KEY (assignID)
);

INSERT INTO wcf1_todo_status (statusID, subject, showOrder, cssClass, locked)
VALUES (1, 'abgeschlossen/solved', 99, 'green', 1);
INSERT INTO wcf1_todo_status (statusID, subject, showOrder, cssClass, locked) VALUES (1, 'abgeschlossen/solved', 99, 'green', 1);
INSERT INTO wcf1_todo_status (statusID, subject, showOrder, cssClass, locked) VALUES (2, 'offen/unsolved', 2, 'red', 0);
INSERT INTO wcf1_todo_status (statusID, subject, showOrder, cssClass, locked)
VALUES (3, 'in Arbeit/in progress', 3, 'yellow', 0);
INSERT INTO wcf1_todo_status (statusID, subject, showOrder, cssClass, locked)
VALUES (4, 'verworfen/canceled', 98, 'gray', 0);
INSERT INTO wcf1_todo_status (statusID, subject, showOrder, cssClass, locked)
VALUES (5, 'in Vorbereitung/in preparation', 1, 'gray', 0);
INSERT INTO wcf1_todo_status (statusID, subject, showOrder, cssClass, locked)
VALUES (6, 'pausiert/paused', 4, 'gray', 0);
INSERT INTO wcf1_todo_status (statusID, subject, showOrder, cssClass, locked) VALUES (3, 'in Arbeit/in progress', 3, 'yellow', 0);
INSERT INTO wcf1_todo_status (statusID, subject, showOrder, cssClass, locked) VALUES (4, 'verworfen/canceled', 98, 'gray', 0);
INSERT INTO wcf1_todo_status (statusID, subject, showOrder, cssClass, locked) VALUES (5, 'in Vorbereitung/in preparation', 1, 'gray', 0);
INSERT INTO wcf1_todo_status (statusID, subject, showOrder, cssClass, locked) VALUES (6, 'pausiert/paused', 4, 'gray', 0);

ALTER TABLE wcf1_user
ADD todos INT(10) NOT NULL DEFAULT 0;
ALTER TABLE wcf1_user ADD todos INT(10) NOT NULL DEFAULT 0;

ALTER TABLE wcf1_todo
ADD FOREIGN KEY (submitter) REFERENCES wcf1_user (userID)
ON DELETE SET NULL;
ALTER TABLE wcf1_todo
ADD FOREIGN KEY (deletedByID) REFERENCES wcf1_user (userID)
ON DELETE SET NULL;
ALTER TABLE wcf1_todo
ADD FOREIGN KEY (statusID) REFERENCES wcf1_todo_status (statusID)
ON DELETE SET NULL;
ALTER TABLE wcf1_todo
ADD FOREIGN KEY (categoryID) REFERENCES wcf1_category (categoryID)
ON DELETE CASCADE;
ALTER TABLE wcf1_todo ADD FOREIGN KEY (submitter) REFERENCES wcf1_user (userID) ON DELETE SET NULL;
ALTER TABLE wcf1_todo ADD FOREIGN KEY (deletedByID) REFERENCES wcf1_user (userID) ON DELETE SET NULL;
ALTER TABLE wcf1_todo ADD FOREIGN KEY (statusID) REFERENCES wcf1_todo_status (statusID) ON DELETE SET NULL;
ALTER TABLE wcf1_todo ADD FOREIGN KEY (categoryID) REFERENCES wcf1_category (categoryID) ON DELETE CASCADE;

ALTER TABLE wcf1_todo_to_user
ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID)
ON DELETE CASCADE;
ALTER TABLE wcf1_todo_to_user
ADD FOREIGN KEY (todoID) REFERENCES wcf1_todo (todoID)
ON DELETE CASCADE;
ALTER TABLE wcf1_todo_to_user ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE;
ALTER TABLE wcf1_todo_to_user ADD FOREIGN KEY (todoID) REFERENCES wcf1_todo (todoID) ON DELETE CASCADE;

ALTER TABLE wcf1_todo_to_group
ADD FOREIGN KEY (groupID) REFERENCES wcf1_user_group (groupID)
ON DELETE CASCADE;
ALTER TABLE wcf1_todo_to_group
ADD FOREIGN KEY (todoID) REFERENCES wcf1_todo (todoID)
ON DELETE CASCADE;
ALTER TABLE wcf1_todo_to_group ADD FOREIGN KEY (groupID) REFERENCES wcf1_user_group (groupID) ON DELETE CASCADE;
ALTER TABLE wcf1_todo_to_group ADD FOREIGN KEY (todoID) REFERENCES wcf1_todo (todoID) ON DELETE CASCADE;
6 changes: 0 additions & 6 deletions update.sql

This file was deleted.

6 changes: 6 additions & 0 deletions update126.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- 1.2.6 (pl 1)
ALTER TABLE wcf1_todo CHANGE timestamp time INT(10) NOT NULL DEFAULT 0;
ALTER TABLE wcf1_todo ADD COLUMN notesHasEmbeddedObjects TINYINT(1) NOT NULL DEFAULT 0;
ALTER TABLE wcf1_todo CHANGE private private TINYINT(1) NOT NULL DEFAULT 0;
ALTER TABLE wcf1_todo CHANGE comments comments INT(10) NOT NULL DEFAULT 0;
ALTER TABLE wcf1_todo CHANGE enableHtml enableHtml TINYINT(1) NOT NULL DEFAULT 0;

0 comments on commit 66c60d5

Please sign in to comment.