diff --git a/reqbaz/build.gradle b/reqbaz/build.gradle index 0ed2d5b2..fc2e72ff 100644 --- a/reqbaz/build.gradle +++ b/reqbaz/build.gradle @@ -222,8 +222,8 @@ task export(type: Copy, dependsOn: build) { } into("sql") { from processResources - include "migrations/*.sql" - rename 'migrations/(.+)', '$1' + include "*.sql" + include "changelog.yaml" } } diff --git a/reqbaz/src/main/resources/migrations/V10__delete_project.sql b/reqbaz/src/main/resources/migrations/V10__delete_project.sql deleted file mode 100644 index d721dc7e..00000000 --- a/reqbaz/src/main/resources/migrations/V10__delete_project.sql +++ /dev/null @@ -1,7 +0,0 @@ -REPLACE INTO reqbaz.privilege - (id, name) -VALUES (37, 'Delete_PROJECT'); - -INSERT INTO reqbaz.role_privilege_map -(role_id, privilege_id) -VALUES (3, 37); diff --git a/reqbaz/src/main/resources/migrations/V11__natural_sort_function.sql b/reqbaz/src/main/resources/migrations/V11__natural_sort_function.sql deleted file mode 100644 index 23d9d94e..00000000 --- a/reqbaz/src/main/resources/migrations/V11__natural_sort_function.sql +++ /dev/null @@ -1,84 +0,0 @@ --- From https://stackoverflow.com/a/12257917/4375998 --- DROP FUNCTION IF EXISTS `udf_FirstNumberPos`; -DELIMITER $$ -CREATE FUNCTION `udf_FirstNumberPos` (`instring` varchar(4000)) - RETURNS int - LANGUAGE SQL - DETERMINISTIC - NO SQL - SQL SECURITY INVOKER -BEGIN -DECLARE position int; -DECLARE tmp_position int; -SET position = 5000; -SET tmp_position = LOCATE('0', instring); IF (tmp_position > 0 AND tmp_position < position) THEN SET position = tmp_position; END IF; -SET tmp_position = LOCATE('1', instring); IF (tmp_position > 0 AND tmp_position < position) THEN SET position = tmp_position; END IF; -SET tmp_position = LOCATE('2', instring); IF (tmp_position > 0 AND tmp_position < position) THEN SET position = tmp_position; END IF; -SET tmp_position = LOCATE('3', instring); IF (tmp_position > 0 AND tmp_position < position) THEN SET position = tmp_position; END IF; -SET tmp_position = LOCATE('4', instring); IF (tmp_position > 0 AND tmp_position < position) THEN SET position = tmp_position; END IF; -SET tmp_position = LOCATE('5', instring); IF (tmp_position > 0 AND tmp_position < position) THEN SET position = tmp_position; END IF; -SET tmp_position = LOCATE('6', instring); IF (tmp_position > 0 AND tmp_position < position) THEN SET position = tmp_position; END IF; -SET tmp_position = LOCATE('7', instring); IF (tmp_position > 0 AND tmp_position < position) THEN SET position = tmp_position; END IF; -SET tmp_position = LOCATE('8', instring); IF (tmp_position > 0 AND tmp_position < position) THEN SET position = tmp_position; END IF; -SET tmp_position = LOCATE('9', instring); IF (tmp_position > 0 AND tmp_position < position) THEN SET position = tmp_position; END IF; - -IF (position = 5000) THEN RETURN 0; END IF; -RETURN position; -END -$$ - --- DROP FUNCTION IF EXISTS `udf_NaturalSortFormat`; -DELIMITER $$ -CREATE FUNCTION `udf_NaturalSortFormat` (`instring` varchar(4000), `numberLength` int, `sameOrderChars` char(50)) - RETURNS varchar(4000) - LANGUAGE SQL - DETERMINISTIC - NO SQL - SQL SECURITY INVOKER -BEGIN -DECLARE sortString varchar(4000); -DECLARE numStartIndex int; -DECLARE numEndIndex int; -DECLARE padLength int; -DECLARE totalPadLength int; -DECLARE i int; -DECLARE sameOrderCharsLen int; - -SET totalPadLength = 0; -SET instring = TRIM(instring); -SET sortString = instring; -SET numStartIndex = udf_FirstNumberPos(instring); -SET numEndIndex = 0; -SET i = 1; -SET sameOrderCharsLen = CHAR_LENGTH(sameOrderChars); - -WHILE (i <= sameOrderCharsLen) DO -SET sortString = REPLACE(sortString, SUBSTRING(sameOrderChars, i, 1), ' '); -SET i = i + 1; -END WHILE; - -WHILE (numStartIndex <> 0) DO -SET numStartIndex = numStartIndex + numEndIndex; -SET numEndIndex = numStartIndex; - -WHILE (udf_FirstNumberPos(SUBSTRING(instring, numEndIndex, 1)) = 1) DO -SET numEndIndex = numEndIndex + 1; -END WHILE; - -SET numEndIndex = numEndIndex - 1; - -SET padLength = numberLength - (numEndIndex + 1 - numStartIndex); - -IF padLength < 0 THEN -SET padLength = 0; -END IF; - -SET sortString = INSERT(sortString, numStartIndex + totalPadLength, 0, REPEAT('0', padLength)); - -SET totalPadLength = totalPadLength + padLength; -SET numStartIndex = udf_FirstNumberPos(RIGHT(instring, CHAR_LENGTH(instring) - numEndIndex)); -END WHILE; - -RETURN sortString; -END -$$ diff --git a/reqbaz/src/main/resources/migrations/V12__comment_delete.sql b/reqbaz/src/main/resources/migrations/V12__comment_delete.sql deleted file mode 100644 index 6d1a16e1..00000000 --- a/reqbaz/src/main/resources/migrations/V12__comment_delete.sql +++ /dev/null @@ -1,11 +0,0 @@ - -SET FOREIGN_KEY_CHECKS = 0; -ALTER TABLE reqbaz.comment - DROP FOREIGN KEY `reply_comment`; - -ALTER TABLE reqbaz.comment - ADD deleted BOOLEAN NOT NULL DEFAULT FALSE, - ADD CONSTRAINT reply_comment FOREIGN KEY reply_comment (reply_to_comment_id) REFERENCES comment (id) - ON DELETE CASCADE; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/reqbaz/src/main/resources/migrations/V13__tags.sql b/reqbaz/src/main/resources/migrations/V13__tags.sql deleted file mode 100644 index f7aef404..00000000 --- a/reqbaz/src/main/resources/migrations/V13__tags.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE TABLE IF NOT EXISTS reqbaz.tag -( - id INT NOT NULL AUTO_INCREMENT, - project_id INT NOT NULL, - creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - name VARCHAR(20) NOT NULL, - colour VARCHAR(7) NOT NULL, - CONSTRAINT tag_project FOREIGN KEY tag_project (project_id) REFERENCES project (id) ON DELETE CASCADE, - CONSTRAINT tag_pk PRIMARY KEY (id) -); - -CREATE TABLE IF NOT EXISTS reqbaz.requirement_tag_map -( - id INT NOT NULL AUTO_INCREMENT, - tag_id INT NOT NULL, - requirement_id INT NOT NULL, - CONSTRAINT requirement_tag_map_pk PRIMARY KEY (id), - CONSTRAINT requirement_tag_map_requirement FOREIGN KEY requirement_tag_map_requirement (requirement_id) REFERENCES requirement (id) - ON DELETE CASCADE, - CONSTRAINT requirement_tag_map_tag FOREIGN KEY requirement_tag_map_tag (tag_id) REFERENCES tag (id) - ON DELETE CASCADE -); diff --git a/reqbaz/src/main/resources/migrations/V14__entity_json_properties.sql b/reqbaz/src/main/resources/migrations/V14__entity_json_properties.sql deleted file mode 100644 index 9b02bf21..00000000 --- a/reqbaz/src/main/resources/migrations/V14__entity_json_properties.sql +++ /dev/null @@ -1,8 +0,0 @@ -ALTER TABLE reqbaz.project - ADD COLUMN additional_properties JSON; - -ALTER TABLE reqbaz.category - ADD COLUMN additional_properties JSON; - -ALTER TABLE reqbaz.requirement - ADD COLUMN additional_properties JSON; diff --git a/reqbaz/src/main/resources/migrations/V1__create_reqbaz_schema.sql b/reqbaz/src/main/resources/migrations/V1__create_reqbaz_schema.sql deleted file mode 100644 index 296fb54f..00000000 --- a/reqbaz/src/main/resources/migrations/V1__create_reqbaz_schema.sql +++ /dev/null @@ -1,318 +0,0 @@ -SET FOREIGN_KEY_CHECKS = 0; - --- tables --- Table attachment -CREATE TABLE IF NOT EXISTS reqbaz.attachment ( - id INT NOT NULL AUTO_INCREMENT, - creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - last_updated_date TIMESTAMP NULL, - requirement_id INT NOT NULL, - user_id INT NOT NULL, - name VARCHAR(255) NOT NULL, - description TEXT NULL, - mime_type VARCHAR(255) NOT NULL, - identifier VARCHAR(900) NOT NULL, - file_url VARCHAR(1000) NOT NULL, - CONSTRAINT attachment_pk PRIMARY KEY (id), - CONSTRAINT attachment_requirement FOREIGN KEY attachment_requirement (requirement_id) REFERENCES requirement (id) - ON DELETE CASCADE, - CONSTRAINT attachment_user FOREIGN KEY attachment_user (user_id) REFERENCES user (id) -); - --- Table comment -CREATE TABLE IF NOT EXISTS reqbaz.comment ( - id INT NOT NULL AUTO_INCREMENT, - message TEXT NOT NULL, - creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - last_updated_date TIMESTAMP NULL, - requirement_id INT NOT NULL, - user_id INT NOT NULL, - reply_to_comment_id INT, - CONSTRAINT comment_pk PRIMARY KEY (id), - CONSTRAINT comment_requirement FOREIGN KEY comment_requirement (requirement_id) REFERENCES requirement (id) - ON DELETE CASCADE, - CONSTRAINT comment_user FOREIGN KEY comment_user (user_id) REFERENCES user (id), - CONSTRAINT reply_comment FOREIGN KEY reply_comment (reply_to_comment_id) REFERENCES comment (id) -); - --- Table category -CREATE TABLE IF NOT EXISTS reqbaz.category ( - id INT NOT NULL AUTO_INCREMENT, - name VARCHAR(255) NOT NULL, - description TEXT NOT NULL, - creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - last_updated_date TIMESTAMP NULL, - project_id INT NOT NULL, - leader_id INT NOT NULL, - CONSTRAINT category_pk PRIMARY KEY (id), - CONSTRAINT category_project FOREIGN KEY category_project (project_id) REFERENCES project (id), - CONSTRAINT category_user FOREIGN KEY category_user (leader_id) REFERENCES user (id) -); - --- Table requirement_developer_map -CREATE TABLE IF NOT EXISTS reqbaz.requirement_developer_map ( - id INT NOT NULL AUTO_INCREMENT, - requirement_id INT NOT NULL, - user_id INT NOT NULL, - creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - CONSTRAINT requirement_developer_map_pk PRIMARY KEY (id), - CONSTRAINT requirement_developer_map_requirement FOREIGN KEY requirement_developer_map_requirement (requirement_id) REFERENCES requirement (id) - ON DELETE CASCADE, - CONSTRAINT requirement_developer_map_user FOREIGN KEY requirement_developer_map_user (user_id) REFERENCES user (id) -); - --- Table follower_requirement_map -CREATE TABLE IF NOT EXISTS reqbaz.requirement_follower_map ( - id INT NOT NULL AUTO_INCREMENT, - requirement_id INT NOT NULL, - user_id INT NOT NULL, - creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - CONSTRAINT requirement_follower_map_pk PRIMARY KEY (id), - CONSTRAINT requirement_follower_map_requirement FOREIGN KEY requirement_follower_map_requirement (requirement_id) REFERENCES requirement (id) - ON DELETE CASCADE, - CONSTRAINT requirement_follower_map_user FOREIGN KEY requirement_follower_user (user_id) REFERENCES user (id) -); - --- Table category_follower_map -CREATE TABLE IF NOT EXISTS reqbaz.category_follower_map ( - id INT NOT NULL AUTO_INCREMENT, - category_id INT NOT NULL, - user_id INT NOT NULL, - creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - CONSTRAINT category_follower_map_pk PRIMARY KEY (id), - CONSTRAINT category_follower_map_category FOREIGN KEY category_follower_map_category (category_id) REFERENCES category (id) - ON DELETE CASCADE, - CONSTRAINT category_follower_map_user FOREIGN KEY category_follower_map_user (user_id) REFERENCES user (id) -); - --- Table project_follower_map -CREATE TABLE IF NOT EXISTS reqbaz.project_follower_map ( - id INT NOT NULL AUTO_INCREMENT, - project_id INT NOT NULL, - user_id INT NOT NULL, - creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - CONSTRAINT project_follower_map_pk PRIMARY KEY (id), - CONSTRAINT project_follower_map_project FOREIGN KEY project_follower_map_project (project_id) REFERENCES project (id) - ON DELETE CASCADE, - CONSTRAINT project_follower_map_user FOREIGN KEY project_follower_map_user (user_id) REFERENCES user (id) -); - --- Table privilege -CREATE TABLE IF NOT EXISTS reqbaz.privilege ( - id INT NOT NULL AUTO_INCREMENT, - name VARCHAR(100) NOT NULL, - CONSTRAINT privilege_pk PRIMARY KEY (id) -); - --- Table project -CREATE TABLE IF NOT EXISTS reqbaz.project ( - id INT NOT NULL AUTO_INCREMENT, - name VARCHAR(255) NOT NULL, - description TEXT NOT NULL, - visibility BOOLEAN NOT NULL, - creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - last_updated_date TIMESTAMP NULL, - leader_id INT NOT NULL, - default_category_id INT NULL, - CONSTRAINT project_pk PRIMARY KEY (id), - CONSTRAINT project_category FOREIGN KEY project_category (default_category_id) REFERENCES category (id), - CONSTRAINT project_user FOREIGN KEY project_user (leader_id) REFERENCES user (id) -); - --- Table requirement -CREATE TABLE IF NOT EXISTS reqbaz.requirement ( - id INT NOT NULL AUTO_INCREMENT, - name VARCHAR(255) NOT NULL, - description TEXT NULL, - realized TIMESTAMP NULL DEFAULT NULL, - creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - last_updated_date TIMESTAMP NULL, - lead_developer_id INT NULL, - creator_id INT NOT NULL, - project_id INT NOT NULL, - CONSTRAINT requirement_pk PRIMARY KEY (id), - CONSTRAINT creator FOREIGN KEY creator (creator_id) REFERENCES user (id), - CONSTRAINT lead_developer FOREIGN KEY lead_developer (lead_developer_id) REFERENCES user (id), - CONSTRAINT requirement_project FOREIGN KEY requirement_project (project_id) REFERENCES project (id) -); - --- Table requirement_category_map -CREATE TABLE IF NOT EXISTS reqbaz.requirement_category_map ( - id INT NOT NULL AUTO_INCREMENT, - category_id INT NOT NULL, - requirement_id INT NOT NULL, - CONSTRAINT requirement_category_map_pk PRIMARY KEY (id), - CONSTRAINT requirement_category_map_category FOREIGN KEY requirement_category_map_category (category_id) REFERENCES category (id), - CONSTRAINT requirement_category_map_requirement FOREIGN KEY requirement_category_map_requirement (requirement_id) REFERENCES requirement (id) - ON DELETE CASCADE -); - --- Table role_privilege_map -CREATE TABLE IF NOT EXISTS reqbaz.role_privilege_map ( - id INT NOT NULL AUTO_INCREMENT, - role_id INT NOT NULL, - privilege_id INT NOT NULL, - CONSTRAINT role_privilege_map_pk PRIMARY KEY (id), - CONSTRAINT role_privilege_map_privilege FOREIGN KEY role_privilege_map_privilege (privilege_id) REFERENCES privilege (id) - ON DELETE CASCADE, - CONSTRAINT role_privilege_map_role FOREIGN KEY role_privilege_map_role (role_id) REFERENCES role (id) - ON DELETE CASCADE -); - --- Table role_role_map -CREATE TABLE IF NOT EXISTS reqbaz.role_role_map ( - id INT NOT NULL AUTO_INCREMENT, - child_id INT NOT NULL, - parent_id INT NOT NULL, - CONSTRAINT role_role_map_pk PRIMARY KEY (id), - CONSTRAINT role_role_map_child FOREIGN KEY role_role_map_child (child_id) REFERENCES role (id) - ON DELETE CASCADE, - CONSTRAINT role_role_map_parent FOREIGN KEY role_role_map_parent (parent_id) REFERENCES role (id) - ON DELETE CASCADE -); - --- Table role -CREATE TABLE IF NOT EXISTS reqbaz.role ( - id INT NOT NULL AUTO_INCREMENT, - name VARCHAR(50) NULL, - CONSTRAINT role_pk PRIMARY KEY (id), - UNIQUE KEY role_idx_1 (name) -); - --- Table user_role_map -CREATE TABLE IF NOT EXISTS reqbaz.user_role_map ( - id INT NOT NULL AUTO_INCREMENT, - role_id INT NOT NULL, - user_id INT NOT NULL, - context_info VARCHAR(255) NULL, - CONSTRAINT user_role_map_pk PRIMARY KEY (id), - CONSTRAINT user_role_map_role FOREIGN KEY user_role_map_role (role_id) REFERENCES role (id) - ON DELETE CASCADE, - CONSTRAINT user_role_map_user FOREIGN KEY user_role_map_user (user_id) REFERENCES user (id) - ON DELETE CASCADE -); - --- Table user -CREATE TABLE IF NOT EXISTS reqbaz.user ( - id INT NOT NULL AUTO_INCREMENT, - first_name VARCHAR(150) NULL, - last_name VARCHAR(150) NULL, - email VARCHAR(255) NOT NULL, - admin BOOLEAN NOT NULL, - las2peer_id BIGINT NOT NULL, - user_name VARCHAR(255) NULL, - profile_image TEXT NULL, - email_lead_subscription BOOLEAN NOT NULL DEFAULT TRUE, - email_follow_subscription BOOLEAN NOT NULL DEFAULT TRUE, - creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - last_updated_date TIMESTAMP NULL, - last_login_date TIMESTAMP NULL, - CONSTRAINT user_pk PRIMARY KEY (id), - UNIQUE KEY las2peer_idx (las2peer_id) -); - --- Table vote -CREATE TABLE IF NOT EXISTS reqbaz.vote ( - id INT NOT NULL AUTO_INCREMENT, - is_upvote BOOLEAN NOT NULL, - requirement_id INT NOT NULL, - user_id INT NOT NULL, - creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - CONSTRAINT vote_pk PRIMARY KEY (id), - CONSTRAINT vote_requirement FOREIGN KEY vote_requirement (requirement_id) REFERENCES requirement (id) - ON DELETE CASCADE, - CONSTRAINT vote_user FOREIGN KEY vote_user (user_id) REFERENCES user (id) -); - --- Fill roles and privileges -REPLACE INTO reqbaz.role -(id, name) -VALUES - (1, 'Anonymous'), - (2, 'LoggedInUser'), - (3, 'ProjectAdmin'), - (4, 'SystemAdmin'); - -REPLACE INTO reqbaz.privilege -(id, name) -VALUES - (1, 'Create_PROJECT'), - (2, 'Read_PROJECT'), - (3, 'Read_PUBLIC_PROJECT'), - (4, 'Modify_PROJECT'), - (5, 'Create_CATEGORY'), - (6, 'Read_CATEGORY'), - (7, 'Read_PUBLIC_CATEGORY'), - (8, 'Modify_CATEGORY'), - (9, 'Create_REQUIREMENT'), - (10, 'Read_REQUIREMENT'), - (11, 'Read_PUBLIC_REQUIREMENT'), - (12, 'Modify_REQUIREMENT'), - (13, 'Create_COMMENT'), - (14, 'Read_COMMENT'), - (15, 'Read_PUBLIC_COMMENT'), - (16, 'Modify_COMMENT'), - (17, 'Create_ATTACHMENT'), - (18, 'Read_ATTACHMENT'), - (19, 'Read_PUBLIC_ATTACHMENT'), - (20, 'Modify_ATTACHMENT'), - (21, 'Create_VOTE'), - (22, 'Delete_VOTE'), - (23, 'Create_FOLLOW'), - (24, 'Delete_FOLLOW'), - (25, 'Create_DEVELOP'), - (26, 'Delete_DEVELOP'); - -REPLACE INTO reqbaz.role_privilege_map -(id, role_id, privilege_id) -VALUES - (1, 1, 3), - (2, 1, 7), - (3, 1, 11), - (4, 1, 15), - (5, 1, 19), - (6, 4, 1), - (7, 4, 2), - (8, 4, 8), - (9, 4, 7), - (10, 4, 6), - (11, 4, 5), - (12, 4, 3), - (13, 4, 4), - (14, 4, 9), - (15, 4, 10), - (16, 4, 11), - (17, 4, 12), - (18, 4, 13), - (19, 4, 14), - (20, 4, 16), - (21, 4, 17), - (22, 4, 18), - (23, 4, 19), - (24, 4, 20), - (25, 4, 21), - (26, 4, 22), - (27, 4, 23), - (28, 4, 24), - (29, 4, 25), - (30, 4, 26); - -REPLACE INTO reqbaz.role_role_map -(id, child_id, parent_id) -VALUES - (1, 2, 1), - (2, 3, 2), - (3, 4, 3); - -REPLACE INTO reqbaz.user_role_map -(id, role_id, user_id) -VALUES - (1, 1, 1); - -REPLACE INTO reqbaz.user -(id, first_name, last_name, email, admin, las2peer_id, user_name, profile_image, email_lead_subscription, email_follow_subscription) -VALUES - (1, NULL, NULL, 'anonymous@requirements-bazaar.org', 0, '-1722613621014065292', 'anonymous', - 'https://api.learning-layers.eu/profile.png', 0, 0); - -SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file diff --git a/reqbaz/src/main/resources/migrations/V2__user_las2peer_id_to_string.sql b/reqbaz/src/main/resources/migrations/V2__user_las2peer_id_to_string.sql deleted file mode 100644 index 48c5493f..00000000 --- a/reqbaz/src/main/resources/migrations/V2__user_las2peer_id_to_string.sql +++ /dev/null @@ -1,7 +0,0 @@ -SET FOREIGN_KEY_CHECKS = 0; - -ALTER TABLE reqbaz.user change las2peer_id las2peer_id VARCHAR(128); - -UPDATE reqbaz.user SET las2peer_id = "anonymous" where id = 1; - -SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file diff --git a/reqbaz/src/main/resources/migrations/V3__add_personalisation_table.sql b/reqbaz/src/main/resources/migrations/V3__add_personalisation_table.sql deleted file mode 100644 index deb522c4..00000000 --- a/reqbaz/src/main/resources/migrations/V3__add_personalisation_table.sql +++ /dev/null @@ -1,25 +0,0 @@ -CREATE TABLE IF NOT EXISTS reqbaz.personalisation_data ( - id INT NOT NULL AUTO_INCREMENT, - creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - last_updated_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - identifier VARCHAR(50) NOT NULL, - user_id INT NOT NULL, - version INT NOT NULL, - setting TEXT, - CONSTRAINT personalisation_pk PRIMARY KEY (id), - CONSTRAINT personalisation_key UNIQUE KEY (identifier,user_id,version), - CONSTRAINT personalisation_user FOREIGN KEY personalisation_user (user_id) REFERENCES user (id) -); - -REPLACE INTO reqbaz.privilege -(id, name) -VALUES -(27, 'Read_PERSONALISATION_DATA'), -(28, 'Create_PERSONALISATION_DATA'); - - -REPLACE INTO reqbaz.role_privilege_map -(id, role_id, privilege_id) -VALUES -(31, 2, 27), -(32, 2, 28); \ No newline at end of file diff --git a/reqbaz/src/main/resources/migrations/V4__add_personalisation_settings.sql b/reqbaz/src/main/resources/migrations/V4__add_personalisation_settings.sql deleted file mode 100644 index 3c703823..00000000 --- a/reqbaz/src/main/resources/migrations/V4__add_personalisation_settings.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE reqbaz.user -ADD personalization_enabled tinyint(1) DEFAULT '1'; \ No newline at end of file diff --git a/reqbaz/src/main/resources/migrations/V5__add_delete_constraints.sql b/reqbaz/src/main/resources/migrations/V5__add_delete_constraints.sql deleted file mode 100644 index 18245134..00000000 --- a/reqbaz/src/main/resources/migrations/V5__add_delete_constraints.sql +++ /dev/null @@ -1,15 +0,0 @@ -SET FOREIGN_KEY_CHECKS = 0; -ALTER TABLE reqbaz.category - DROP FOREIGN KEY `category_project`; - -ALTER TABLE reqbaz.category - ADD CONSTRAINT category_project FOREIGN KEY category_project (project_id) REFERENCES project (id) - ON DELETE CASCADE; - -ALTER TABLE reqbaz.project - DROP FOREIGN KEY `project_category`; - -ALTER TABLE reqbaz.project - ADD CONSTRAINT project_category FOREIGN KEY project_category (default_category_id) REFERENCES category (id) - ON DELETE CASCADE; -SET FOREIGN_KEY_CHECKS = 1; diff --git a/reqbaz/src/main/resources/migrations/V6__add_feedback.sql b/reqbaz/src/main/resources/migrations/V6__add_feedback.sql deleted file mode 100644 index c6afb9e0..00000000 --- a/reqbaz/src/main/resources/migrations/V6__add_feedback.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE IF NOT EXISTS reqbaz.feedback ( - id INT NOT NULL AUTO_INCREMENT, - project_id INT NOT NULL, - requirement_id INT, - creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - email VARCHAR(255), - feedback TEXT NOT NULL, - CONSTRAINT feedback_project FOREIGN KEY feedback_project (project_id) REFERENCES project (id) ON DELETE CASCADE, - CONSTRAINT feedback_pk PRIMARY KEY (id) -); diff --git a/reqbaz/src/main/resources/migrations/V7__utf8mb4_conversion.sql b/reqbaz/src/main/resources/migrations/V7__utf8mb4_conversion.sql deleted file mode 100644 index df13e920..00000000 --- a/reqbaz/src/main/resources/migrations/V7__utf8mb4_conversion.sql +++ /dev/null @@ -1,19 +0,0 @@ -alter table reqbaz.attachment convert to character set utf8mb4 collate utf8mb4_unicode_ci; -alter table reqbaz.category convert to character set utf8mb4 collate utf8mb4_unicode_ci; -alter table reqbaz.category_follower_map convert to character set utf8mb4 collate utf8mb4_unicode_ci; -alter table reqbaz.comment convert to character set utf8mb4 collate utf8mb4_unicode_ci; -alter table reqbaz.feedback convert to character set utf8mb4 collate utf8mb4_unicode_ci; -alter table reqbaz.personalisation_data convert to character set utf8mb4 collate utf8mb4_unicode_ci; -alter table reqbaz.privilege convert to character set utf8mb4 collate utf8mb4_unicode_ci; -alter table reqbaz.project convert to character set utf8mb4 collate utf8mb4_unicode_ci; -alter table reqbaz.project_follower_map convert to character set utf8mb4 collate utf8mb4_unicode_ci; -alter table reqbaz.requirement convert to character set utf8mb4 collate utf8mb4_unicode_ci; -alter table reqbaz.requirement_category_map convert to character set utf8mb4 collate utf8mb4_unicode_ci; -alter table reqbaz.requirement_developer_map convert to character set utf8mb4 collate utf8mb4_unicode_ci; -alter table reqbaz.requirement_follower_map convert to character set utf8mb4 collate utf8mb4_unicode_ci; -alter table reqbaz.role convert to character set utf8mb4 collate utf8mb4_unicode_ci; -alter table reqbaz.role_privilege_map convert to character set utf8mb4 collate utf8mb4_unicode_ci; -alter table reqbaz.role_role_map convert to character set utf8mb4 collate utf8mb4_unicode_ci; -alter table reqbaz.user convert to character set utf8mb4 collate utf8mb4_unicode_ci; -alter table reqbaz.user_role_map convert to character set utf8mb4 collate utf8mb4_unicode_ci; -alter table reqbaz.vote convert to character set utf8mb4 collate utf8mb4_unicode_ci; diff --git a/reqbaz/src/main/resources/migrations/V8__new_privileges.sql b/reqbaz/src/main/resources/migrations/V8__new_privileges.sql deleted file mode 100644 index fe1fe86e..00000000 --- a/reqbaz/src/main/resources/migrations/V8__new_privileges.sql +++ /dev/null @@ -1,79 +0,0 @@ -REPLACE INTO reqbaz.privilege - (id, name) -VALUES (29, 'Read_FEEDBACK'), - (31, 'Promote_USER'), - (32, 'Realize_REQUIREMENT'), - (34, 'Modify_MEMBERS'), - (35, 'Modify_ADMIN_MEMBERS'), - (36, 'Read_USERS'); - - -REPLACE INTO reqbaz.role - (id, name) -VALUES (5, 'ProjectManager'), - (6, 'ProjectMember'); - -TRUNCATE TABLE reqbaz.role_privilege_map; -# This ist quite difficult to read -# For more info see the privileges documentation -# or run this query: -# SELECT rpm.id, r.name, p.name, p.id FROM reqbaz.role_privilege_map rpm JOIN reqbaz.role AS r on r.id = rpm.role_id JOIN reqbaz.privilege AS p ON p.id = rpm.privilege_id order by r.name asc, p.name asc; -INSERT INTO reqbaz.role_privilege_map - (role_id, privilege_id) -VALUES (1, 3), - (1, 7), - (1, 11), - (1, 15), - (1, 19), - - (2, 1), - (2, 9), - (2, 13), - (2, 17), - (2, 21), - (2, 22), - (2, 23), - (2, 24), - (2, 27), - (2, 28), - (2, 36), - - (3, 4), - (3, 8), - (3, 35), - - (5, 29), - (5, 31), - (5, 12), - (5, 16), - (5, 20), - (5, 5), - (5, 34), - - (6, 2), - (6, 6), - (6, 25), - (6, 26), - (6, 18), - (6, 14), - (6, 10), - (6, 32); - -TRUNCATE TABLE reqbaz.role_role_map; -INSERT INTO reqbaz.role_role_map -(child_id, parent_id) -VALUES -(4, 3), -(3, 5), -(5, 6), -(6, 2), -(2, 1); - -ALTER TABLE reqbaz.user_role_map - MODIFY context_info INT; - -ALTER TABLE reqbaz.user_role_map - ADD CONSTRAINT role_project_context FOREIGN KEY role_project_context (context_info) REFERENCES project (id) - ON DELETE CASCADE; - -ALTER TABLE reqbaz.user DROP COLUMN admin; diff --git a/reqbaz/src/main/resources/migrations/V9__more_delete_constraints.sql b/reqbaz/src/main/resources/migrations/V9__more_delete_constraints.sql deleted file mode 100644 index 7d35654d..00000000 --- a/reqbaz/src/main/resources/migrations/V9__more_delete_constraints.sql +++ /dev/null @@ -1,16 +0,0 @@ -SET FOREIGN_KEY_CHECKS = 0; -ALTER TABLE reqbaz.requirement_category_map - DROP FOREIGN KEY `requirement_category_map_category`; - -ALTER TABLE reqbaz.requirement_category_map - ADD CONSTRAINT requirement_category_map_category FOREIGN KEY requirement_category_map_category (category_id) REFERENCES category (id) ON DELETE CASCADE; - - -ALTER TABLE reqbaz.requirement - DROP FOREIGN KEY `requirement_project`; - -ALTER TABLE reqbaz.requirement - ADD CONSTRAINT requirement_project FOREIGN KEY requirement_project (project_id) REFERENCES project (id) ON DELETE CASCADE; - - -SET FOREIGN_KEY_CHECKS = 1;