From 308092abbdde2ff5c2c4144f951a15d4f59ac531 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Tue, 18 Oct 2022 21:14:49 -0700 Subject: [PATCH] Update MySQL schema --- config/database/mysql/create-schemas.sql | 14 +----- config/database/mysql/drop-schemas.sql | 1 - config/database/mysql/v2.0-to-v3.0.sql | 57 ---------------------- config/database/mysql/v3.0-to-v3.0.1.sql | 5 -- config/database/mysql/v3.0.2-to-v3.0.3.sql | 37 -------------- 5 files changed, 1 insertion(+), 113 deletions(-) delete mode 100644 config/database/mysql/v2.0-to-v3.0.sql delete mode 100644 config/database/mysql/v3.0-to-v3.0.1.sql delete mode 100644 config/database/mysql/v3.0.2-to-v3.0.3.sql diff --git a/config/database/mysql/create-schemas.sql b/config/database/mysql/create-schemas.sql index eba00226..974a14a4 100644 --- a/config/database/mysql/create-schemas.sql +++ b/config/database/mysql/create-schemas.sql @@ -42,8 +42,6 @@ CREATE TABLE MINDMAP ( creation_date DATETIME, edition_date DATETIME, creator_id INTEGER NOT NULL, - tags VARCHAR(1014) - CHARACTER SET utf8, last_editor_id INTEGER NOT NULL, FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id) ON DELETE CASCADE @@ -110,17 +108,7 @@ CREATE TABLE COLLABORATION ( FOREIGN KEY (properties_id) REFERENCES COLLABORATION_PROPERTIES (id) ON DELETE CASCADE ON UPDATE NO ACTION -) - CHARACTER SET utf8; - -CREATE TABLE TAG ( - id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, - name VARCHAR(255) - CHARACTER SET utf8 NOT NULL, - user_id INTEGER NOT NULL, - FOREIGN KEY (user_id) REFERENCES USER (colaborator_id) - ON DELETE CASCADE - ON UPDATE NO ACTION + UNIQUE KEY UC_ROLE (mindmap_id,colaborator_id) ) CHARACTER SET utf8; diff --git a/config/database/mysql/drop-schemas.sql b/config/database/mysql/drop-schemas.sql index 40880f18..d1a1e95d 100644 --- a/config/database/mysql/drop-schemas.sql +++ b/config/database/mysql/drop-schemas.sql @@ -1,4 +1,3 @@ -DROP TABLE IF EXISTS TAG; DROP TABLE IF EXISTS ACCESS_AUDITORY; DROP TABLE IF EXISTS COLLABORATION; DROP TABLE IF EXISTS COLLABORATION_PROPERTIES; diff --git a/config/database/mysql/v2.0-to-v3.0.sql b/config/database/mysql/v2.0-to-v3.0.sql deleted file mode 100644 index 5d7cf10d..00000000 --- a/config/database/mysql/v2.0-to-v3.0.sql +++ /dev/null @@ -1,57 +0,0 @@ -CREATE TABLE COLLABORATION_PROPERTIES ( - id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, - starred BOOL NOT NULL DEFAULT 0, - mindmap_properties VARCHAR(512) - CHARACTER SET utf8 -) - CHARACTER SET utf8; - -DROP TABLE `MINDMAP_NATIVE`; -ALTER TABLE `MINDMAP_COLABORATOR` RENAME TO `COLLABORATION`; -ALTER TABLE `COLABORATOR` RENAME TO `COLLABORATOR`; - -ALTER TABLE `MINDMAP` DROP COLUMN `editor_properties`, DROP COLUMN `mindMapNative_id`; - -ALTER TABLE `MINDMAP` CHANGE COLUMN `owner_id` `creator_id` INT(11) NOT NULL -, DROP INDEX `owner_id` -, ADD INDEX `owner_id` (`creator_id` ASC); - -ALTER TABLE `COLLABORATION` ADD COLUMN `properties_id` INT(11) NULL DEFAULT NULL -AFTER `role_id`; -DROP TABLE USER_LOGIN; - -CREATE TABLE ACCESS_AUDITORY ( - id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, - user_id INTEGER NOT NULL, - login_date DATE -) - CHARACTER SET utf8; - -#ALTER TABLE ACCESS_AUDITORY -# ADD CONSTRAINT `user_id` -# FOREIGN KEY () -# REFERENCES `USER` () -# ON DELETE CASCADE -# ON UPDATE NO ACTION -#, ADD INDEX `user_id` () ; - -ALTER TABLE `MINDMAP_HISTORY` DROP COLUMN `creator_user`, ADD COLUMN `editor_id` INT(11) NULL DEFAULT NULL AFTER `creation_date`; - -ALTER TABLE `USER` ADD COLUMN `locale` VARCHAR(5) NULL -AFTER `allowSendEmail`; - -ALTER TABLE `MINDMAP` DROP COLUMN `last_editor`, ADD COLUMN `last_editor_id` INT(11) NULL DEFAULT 2 -AFTER `tags`; - -ALTER TABLE `USER` DROP COLUMN `username`, CHANGE COLUMN `activationCode` `activation_code` BIGINT(20) NOT NULL, CHANGE COLUMN `allowSendEmail` `allow_send_email` CHAR(1) NOT NULL DEFAULT '0'; - -INSERT INTO `MINDMAP` (`last_editor_id`) VALUES (1); - -INSERT INTO `COLLABORATOR` (`id`, `email`, `creation_date`) VALUES (8081, 'migfake@wis.com', '2007-10-09'); -DELETE FROM `USER` -WHERE activation_date IS null; -DROP TABLE FEEDBACK; - - -ALTER TABLE `MINDMAP` CHANGE COLUMN `XML` `XML` MEDIUMBLOB NULL DEFAULT NULL; -ALTER TABLE `MINDMAP_HISTORY` CHANGE COLUMN `XML` `XML` MEDIUMBLOB NULL DEFAULT NULL; diff --git a/config/database/mysql/v3.0-to-v3.0.1.sql b/config/database/mysql/v3.0-to-v3.0.1.sql deleted file mode 100644 index 4f7b822a..00000000 --- a/config/database/mysql/v3.0-to-v3.0.1.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE `USER` ADD COLUMN `authentication_type` CHAR(1) CHARACTER SET utf8 NOT NULL DEFAULT 'D' -AFTER `colaborator_id`; - -ALTER TABLE `USER` ADD COLUMN `authenticator_uri` VARCHAR(255) CHARACTER SET utf8 -AFTER `authentication_type`; \ No newline at end of file diff --git a/config/database/mysql/v3.0.2-to-v3.0.3.sql b/config/database/mysql/v3.0.2-to-v3.0.3.sql deleted file mode 100644 index 094dfa9d..00000000 --- a/config/database/mysql/v3.0.2-to-v3.0.3.sql +++ /dev/null @@ -1,37 +0,0 @@ -ALTER TABLE `USER` DROP COLUMN `id`; - -ALTER TABLE `ACCESS_AUDITORY` - ADD CONSTRAINT - FOREIGN KEY (user_id) REFERENCES USER (colaborator_id) - ON DELETE CASCADE - ON UPDATE NO ACTION; - -CREATE TABLE LABEL ( - id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, - title VARCHAR(30) - CHARACTER SET utf8 NOT NULL, - creator_id INTEGER NOT NULL, - parent_label_id INTEGER, - color VARCHAR(7) NOT NULL, - FOREIGN KEY (creator_id) REFERENCES USER (colaborator_id), - FOREIGN KEY (parent_label_id) REFERENCES LABEL (id) - ON DELETE CASCADE - ON UPDATE NO ACTION -) - CHARACTER SET utf8; - -CREATE TABLE R_LABEL_MINDMAP ( - mindmap_id INTEGER NOT NULL, - label_id INTEGER NOT NULL, - PRIMARY KEY (mindmap_id, label_id), - FOREIGN KEY (mindmap_id) REFERENCES MINDMAP (id), - FOREIGN KEY (label_id) REFERENCES LABEL (id) - ON DELETE CASCADE - ON UPDATE NO ACTION -) - CHARACTER SET utf8; - -ALTER TABLE `LABEL` - ADD COLUMN iconName VARCHAR(50) NOT NULL; - -UPDATE LABEL SET iconName = 'glyphicon glyphicon-tag';