diff --git a/src/install.sql b/src/install.sql index ead9757..7eb8396 100644 --- a/src/install.sql +++ b/src/install.sql @@ -36,6 +36,7 @@ CREATE TABLE cms1_news ( ); -- news TO user +-- since 1.2.0 Beta 2 DROP TABLE IF EXISTS cms1_news_to_user; CREATE TABLE cms1_news_to_user ( newsID INT(10) NOT NULL, @@ -47,8 +48,8 @@ CREATE TABLE cms1_news_to_user ( -- news TO category DROP TABLE IF EXISTS cms1_news_to_category; CREATE TABLE cms1_news_to_category ( - categoryID INT(10) NOT NULL, - newsID INT(10) NOT NULL, + categoryID INT(10), + newsID INT(10), PRIMARY KEY (categoryID, newsID) ); @@ -74,12 +75,13 @@ ALTER TABLE cms1_news_to_category ADD FOREIGN KEY (newsID) REFERENCES cms1_news (newsID) ON DELETE CASCADE; +-- 1.2.0 Beta 2 ALTER TABLE cms1_news_to_user ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) - ON DELETE SET NULL; + ON DELETE CASCADE; ALTER TABLE cms1_news_to_user ADD FOREIGN KEY (newsID) REFERENCES cms1_news (newsID) - ON DELETE SET NULL; + ON DELETE CASCADE; -- 1.2.0 Beta 2 ALTER TABLE cms1_news diff --git a/src/package.xml b/src/package.xml index 46a3717..748f17f 100644 --- a/src/package.xml +++ b/src/package.xml @@ -6,22 +6,22 @@ - + - codeQuake + codeQuake, MysteryCode https://www.mysterycode.de/ com.woltlab.wcf - de.codequake.cms + de.codequake.cms com.woltlab.wcf - de.voolia.news + de.voolia.news diff --git a/src/update.sql b/src/update.sql index a35e45a..33eac5e 100644 --- a/src/update.sql +++ b/src/update.sql @@ -6,3 +6,15 @@ ALTER TABLE cms1_news ADD COLUMN isDelayed TINYINT(1) NOT NULL DEFAULT 0 ALTER TABLE cms1_news ADD COLUMN hasLabels TINYINT(1) NOT NULL DEFAULT 0; ALTER TABLE cms1_news ADD FOREIGN KEY (deletedByID) REFERENCES wcf1_user (userID) ON DELETE SET NULL; + +-- news TO user +DROP TABLE IF EXISTS cms1_news_to_user; +CREATE TABLE cms1_news_to_user ( + newsID INT(10), + userID INT(10), + + PRIMARY KEY (userID, newsID) +); + +ALTER TABLE cms1_news_to_user ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE; +ALTER TABLE cms1_news_to_user ADD FOREIGN KEY (newsID) REFERENCES cms1_news (newsID) ON DELETE CASCADE;