--  *********************************************************************
--  Update Database Script
--  *********************************************************************
--  Change Log: /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/upgrade/upgrade.changelog-up-to-1.19.0.xml
--  Ran at: 03/04/20 12:06
--  Against: squashtest_adm@localhost@jdbc:mysql://localhost:3306/squashtest_maint
--  Liquibase version: 2.0.5
--  *********************************************************************

--  Lock Database
--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0::cholc::(Checksum: 3:d3d81ed256b747e5db448be4a5aefcfb)
--  Update TM database version number
UPDATE `CORE_CONFIG` SET `VALUE` = '1.19.0' WHERE STR_KEY = 'squashtest.tm.database.version';

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('cholc', 'Update TM database version number', NOW(), 'Update Data', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0', '2.0.5', '3:d3d81ed256b747e5db448be4a5aefcfb', 427);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-400-info-list-item::cholc::(Checksum: 3:d584cfc9f0ba4144f5ca3bf8b2ae0368)
--  Adds a colour field to info list items
ALTER TABLE `INFO_LIST_ITEM` ADD `COLOUR` VARCHAR(7);

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('cholc', 'Adds a colour field to info list items', NOW(), 'Add Column', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-400-info-list-item', '2.0.5', '3:d584cfc9f0ba4144f5ca3bf8b2ae0368', 428);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-400-custom-field-option::cholc::(Checksum: 3:87b21b7fc5312cc9edd70e3c9c966412)
--  Adds a colour field to custom field options
ALTER TABLE `CUSTOM_FIELD_OPTION` ADD `COLOUR` VARCHAR(7);

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('cholc', 'Adds a colour field to custom field options', NOW(), 'Add Column', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-400-custom-field-option', '2.0.5', '3:87b21b7fc5312cc9edd70e3c9c966412', 429);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-409-iteration-test-suite-remove-constraint::cholc::(Checksum: 3:22b03dcec1047040f59f8715f3cfad6b)
--  To drop an unique constraint, you need the constraint's name, which we don't have, so here we copy the
--        column and delete the original
ALTER TABLE `ITERATION_TEST_SUITE` ADD `TEST_SUITE_ID_TEMP` BIGINT;

ALTER TABLE `ITERATION_TEST_SUITE` DROP FOREIGN KEY `fk_iteration_test_suite_suite`;

UPDATE `ITERATION_TEST_SUITE` SET `TEST_SUITE_ID_TEMP` = TEST_SUITE_ID;

ALTER TABLE `ITERATION_TEST_SUITE` DROP COLUMN `TEST_SUITE_ID`;

ALTER TABLE `ITERATION_TEST_SUITE` CHANGE `TEST_SUITE_ID_TEMP` `TEST_SUITE_ID` BIGINT;

ALTER TABLE `ITERATION_TEST_SUITE` MODIFY `TEST_SUITE_ID` BIGINT NOT NULL;

ALTER TABLE `ITERATION_TEST_SUITE` ADD CONSTRAINT `fk_iteration_test_suite_suite` FOREIGN KEY (`TEST_SUITE_ID`) REFERENCES `TEST_SUITE` (`ID`);

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('cholc', 'To drop an unique constraint, you need the constraint''s name, which we don''t have, so here we copy the
      column and delete the original', NOW(), 'Add Column, Drop Foreign Key Constraint, Update Data, Drop Column, Rename Column, Add Not-Null Constraint, Add Foreign Key Constraint', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-409-iteration-test-suite-remove-constraint', '2.0.5', '3:22b03dcec1047040f59f8715f3cfad6b', 430);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-409-iteration-test-suite-order::cholc::(Checksum: 3:c512c914417320cd100101503b18fcf3)
--  add an order to iterations' test suites
ALTER TABLE `ITERATION_TEST_SUITE` ADD `ITERATION_TEST_SUITE_ORDER` INT;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('cholc', 'add an order to iterations'' test suites', NOW(), 'Add Column', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-409-iteration-test-suite-order', '2.0.5', '3:c512c914417320cd100101503b18fcf3', 431);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-409-iteration-test-suite-order-generation::cholc::(Checksum: 3:b73c29a780afdaf27b12d8a48e1f8fdf)
--  will compute the order of the test suites in the iterations, should work for all databases
UPDATE ITERATION_TEST_SUITE ITS
      SET
      ITERATION_TEST_SUITE_ORDER = (SELECT
      SUB_QUERY.ORDER_DEF
      FROM
      (SELECT
      ITS1.ITERATION_ID AS I_ID,
      ITS1.TEST_SUITE_ID AS TS_ID,
      (COUNT(*) - 1) AS ORDER_DEF
      FROM
      ITERATION_TEST_SUITE ITS1
      INNER JOIN ITERATION_TEST_SUITE ITS2 ON ITS1.ITERATION_ID = ITS2.ITERATION_ID
      AND ITS1.TEST_SUITE_ID >= ITS2.TEST_SUITE_ID
      GROUP BY ITS1.ITERATION_ID , ITS1.TEST_SUITE_ID) AS SUB_QUERY
      WHERE
      SUB_QUERY.I_ID = ITS.ITERATION_ID
      AND SUB_QUERY.TS_ID = ITS.TEST_SUITE_ID);

ALTER TABLE `ITERATION_TEST_SUITE` ADD CONSTRAINT `uc_iteration_iteration_test_suite_order` UNIQUE (`ITERATION_ID`, `ITERATION_TEST_SUITE_ORDER`);

ALTER TABLE `ITERATION_TEST_SUITE` MODIFY `ITERATION_TEST_SUITE_ORDER` INT NOT NULL;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('cholc', 'will compute the order of the test suites in the iterations, should work for all databases', NOW(), 'Custom SQL, Add Unique Constraint, Add Not-Null Constraint', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-409-iteration-test-suite-order-generation', '2.0.5', '3:b73c29a780afdaf27b12d8a48e1f8fdf', 432);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-up-sb2-1::bsiri::(Checksum: 3:4cc64120c97287a177d3aafad69bfea2)
--  Passwords are now much longer since we also store the salt.
ALTER TABLE `AUTH_USER` MODIFY `PASSWORD` VARCHAR(255);

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('bsiri', 'Passwords are now much longer since we also store the salt.', NOW(), 'Modify data type', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-up-sb2-1', '2.0.5', '3:4cc64120c97287a177d3aafad69bfea2', 433);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-399-infolist-items-default-colours::cholc::(Checksum: 3:b8c2d1e791c8dbffaf6974dac5a9d69d)
--  Test cases types colours
UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#C3AB77' WHERE CODE = 'CAT_TEST_REQUIREMENT';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#CDCDCD' WHERE CODE = 'CAT_UNDEFINED';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#8F6057' WHERE CODE = 'CAT_ERGONOMIC';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#FCCA46' WHERE CODE = 'CAT_PERFORMANCE';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#233D4D' WHERE CODE = 'CAT_TECHNICAL';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#094C75' WHERE CODE = 'CAT_USER_STORY';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#FE7F2D' WHERE CODE = 'CAT_SECURITY';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#7594CD' WHERE CODE = 'CAT_FUNCTIONAL';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#BB5759' WHERE CODE = 'CAT_NON_FUNCTIONAL';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#A1C181' WHERE CODE = 'CAT_USE_CASE';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#619B8A' WHERE CODE = 'CAT_BUSINESS';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#A1C181' WHERE CODE = 'NAT_USER_TESTING';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#FCCA46' WHERE CODE = 'NAT_PERFORMANCE_TESTING';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#FE7F2D' WHERE CODE = 'NAT_SECURITY_TESTING';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#233D4D' WHERE CODE = 'NAT_ATDD';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#CDCDCD' WHERE CODE = 'NAT_UNDEFINED';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#7594CD' WHERE CODE = 'NAT_FUNCTIONAL_TESTING';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#BB5759' WHERE CODE = 'NAT_NON_FUNCTIONAL_TESTING';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#619B8A' WHERE CODE = 'NAT_BUSINESS_TESTING';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#CDCDCD' WHERE CODE = 'TYP_UNDEFINED';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#5B9367' WHERE CODE = 'TYP_COMPLIANCE_TESTING';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#CD533B' WHERE CODE = 'TYP_CORRECTION_TESTING';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#D8A86E' WHERE CODE = 'TYP_EVOLUTION_TESTING';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#F2E77E' WHERE CODE = 'TYP_REGRESSION_TESTING';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#2D5635' WHERE CODE = 'TYP_END_TO_END_TESTING';

UPDATE `INFO_LIST_ITEM` SET `COLOUR` = '#F2E2CE' WHERE CODE = 'TYP_PARTNER_TESTING';

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('cholc', 'Test cases types colours', NOW(), 'Update Data (x26)', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-399-infolist-items-default-colours', '2.0.5', '3:b8c2d1e791c8dbffaf6974dac5a9d69d', 434);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-453-execution-name-maxlength::jprioux::(Checksum: 3:7b31ef852637835eb24a4bac66c92278)
--  Increase max length for execution name
ALTER TABLE `EXECUTION` MODIFY `NAME` VARCHAR(308);

ALTER TABLE `EXECUTION` MODIFY `NAME` VARCHAR(308) NOT NULL;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('jprioux', 'Increase max length for execution name', NOW(), 'Modify data type, Add Not-Null Constraint', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-453-execution-name-maxlength', '2.0.5', '3:7b31ef852637835eb24a4bac66c92278', 435);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-508-automation-request::aboittiaux::(Checksum: 3:57688d891e39b5c6935492f33d73f598)
--  Create table AUTOMATION_REQUEST to Gherkin's test cases
CREATE TABLE `AUTOMATION_REQUEST` (`AUTOMATION_REQUEST_ID` BIGINT AUTO_INCREMENT NOT NULL, `REQUEST_STATUS` VARCHAR(25) DEFAULT 'WORK_IN_PROGRESS' NOT NULL, `TRANSMITTED_ON` DATETIME NULL, `ASSIGNED_TO` BIGINT NULL, `AUTOMATION_PRIORITY` INT NULL, `ASSIGNED_ON` DATETIME NULL, `TEST_CASE_ID` BIGINT NULL, `CREATED_BY` BIGINT NULL, `TRANSMITTED_BY` BIGINT NULL, `PROJECT_ID` BIGINT NOT NULL, CONSTRAINT `PK_AUTOMATION_REQUEST` PRIMARY KEY (`AUTOMATION_REQUEST_ID`), CONSTRAINT `fk_automation_request_project` FOREIGN KEY (`PROJECT_ID`) REFERENCES PROJECT(PROJECT_ID));

CREATE INDEX `automation_request_assigned_to_idx` ON `AUTOMATION_REQUEST`(`ASSIGNED_TO`);

CREATE INDEX `automation_request_created_by_idx` ON `AUTOMATION_REQUEST`(`CREATED_BY`);

CREATE INDEX `automation_request_transmitted_by_idx` ON `AUTOMATION_REQUEST`(`TRANSMITTED_BY`);

CREATE INDEX `automation_request_test_case_id_idx` ON `AUTOMATION_REQUEST`(`TEST_CASE_ID`);

ALTER TABLE `AUTOMATION_REQUEST` ADD CONSTRAINT `fk_automation_request_automation_assigned_to` FOREIGN KEY (`ASSIGNED_TO`) REFERENCES `CORE_USER` (`PARTY_ID`) ON DELETE SET NULL;

ALTER TABLE `AUTOMATION_REQUEST` ADD CONSTRAINT `fk_automation_request_transmitted_by` FOREIGN KEY (`TRANSMITTED_BY`) REFERENCES `CORE_USER` (`PARTY_ID`) ON DELETE SET NULL;

ALTER TABLE `AUTOMATION_REQUEST` ADD CONSTRAINT `fk_automation_request_created_by` FOREIGN KEY (`CREATED_BY`) REFERENCES `CORE_USER` (`PARTY_ID`) ON DELETE SET NULL;

ALTER TABLE `AUTOMATION_REQUEST` ADD CONSTRAINT `fk_automation_request_test_case` FOREIGN KEY (`TEST_CASE_ID`) REFERENCES `TEST_CASE` (`TCLN_ID`) ON DELETE SET NULL;

ALTER TABLE `TEST_CASE` ADD `AUTOMATABLE` CHAR DEFAULT 'M';

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('aboittiaux', 'Create table AUTOMATION_REQUEST to Gherkin''s test cases', NOW(), 'Create Table, Create Index (x4), Add Foreign Key Constraint (x4), Add Column', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-508-automation-request', '2.0.5', '3:57688d891e39b5c6935492f33d73f598', 436);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-519-automation-request-library-1::bsiri::(Checksum: 3:66a8db91cecb3ecaa2a7a00b08298bcd)
--  Creating the AutomationRequestLibrary
CREATE TABLE `AUTOMATION_REQUEST_LIBRARY` (`ARL_ID` BIGINT AUTO_INCREMENT NOT NULL, `ATTACHMENT_LIST_ID` BIGINT NULL, CONSTRAINT `PK_AUTOMATION_REQUEST_LIBRARY` PRIMARY KEY (`ARL_ID`), CONSTRAINT `fk_autorequestLib_attachment_list` FOREIGN KEY (`ATTACHMENT_LIST_ID`) REFERENCES ATTACHMENT_LIST(ATTACHMENT_LIST_ID));

CREATE INDEX `idx_automation_request_library` ON `AUTOMATION_REQUEST_LIBRARY`(`ARL_ID`);

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('bsiri', 'Creating the AutomationRequestLibrary', NOW(), 'Create Table, Create Index', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-519-automation-request-library-1', '2.0.5', '3:66a8db91cecb3ecaa2a7a00b08298bcd', 437);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-519-automation-request-library-2::bsiri::(Checksum: 3:47c6c9e84780e5a1c588f561a12d2397)
--  New entries in the ACL infrastructure.
insert into ACL_CLASS(ID, CLASSNAME) values(7,
      'org.squashtest.tm.domain.tf.automationrequest.AutomationRequestLibrary');

insert into ACL_GROUP(ID, QUALIFIED_NAME) values(10, 'squashtest.acl.group.tm.AutomatedTestWriter');

insert into ACL_GROUP_PERMISSION(ACL_GROUP_ID, PERMISSION_MASK, CLASS_ID)
      select AGP2.ACL_GROUP_ID, AGP2.PERMISSION_MASK, 7
      from ACL_GROUP_PERMISSION AGP2
      where CLASS_ID = 3;

insert into ACL_GROUP_PERMISSION(ACL_GROUP_ID, CLASS_ID, PERMISSION_MASK) values
      (2, 7, 8192),
      (5, 7, 8192),
      (5, 7, 16384),
      (7, 7, 8192),
      (8, 7, 8192),
      (9, 7, 8192),
      (10, 2, 1),
      (10, 3, 1),
      (10, 4, 1),
      (10, 6, 1),
      (10, 7, 1),
      (10, 7, 2),
      (10, 7, 4),
      (10, 7, 8),
      (10, 7, 64),
      (10, 7, 256),
      (10, 7, 1024),
      (10, 7, 4096),
      (10, 7, 16384);

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('bsiri', 'New entries in the ACL infrastructure.', NOW(), 'Custom SQL', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-519-automation-request-library-2', '2.0.5', '3:47c6c9e84780e5a1c588f561a12d2397', 438);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-519-automation-request-library-3::bsiri::(Checksum: 3:4746725392d62c8fccf251b227540743)
--  The automation request library content table
CREATE TABLE `AUTOMATION_REQUEST_LIBRARY_CONTENT` (`LIBRARY_ID` BIGINT NOT NULL, `CONTENT_ID` BIGINT NOT NULL, CONSTRAINT `fk_automation_rquest_lib_content_lib` FOREIGN KEY (`LIBRARY_ID`) REFERENCES AUTOMATION_REQUEST_LIBRARY(ARL_ID), CONSTRAINT `fk_automation_request_lib_content_content` FOREIGN KEY (`CONTENT_ID`) REFERENCES AUTOMATION_REQUEST(AUTOMATION_REQUEST_ID), UNIQUE (`CONTENT_ID`));

CREATE INDEX `idx_automation_request_lib_content_content` ON `AUTOMATION_REQUEST_LIBRARY_CONTENT`(`CONTENT_ID`);

CREATE INDEX `idx_automation_request_lib_content_lib` ON `AUTOMATION_REQUEST_LIBRARY_CONTENT`(`LIBRARY_ID`);

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('bsiri', 'The automation request library content table', NOW(), 'Create Table, Create Index (x2)', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-519-automation-request-library-3', '2.0.5', '3:4746725392d62c8fccf251b227540743', 439);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-519-automation-request-library-4::bsiri::(Checksum: 3:245b79ba9eaa831942ab29d9cf2b13b3)
--  Add a Project fk to the AutomationRequestLibrary
ALTER TABLE `PROJECT` ADD `ARL_ID` BIGINT;

ALTER TABLE `PROJECT` ADD CONSTRAINT `fk_project_arl` FOREIGN KEY (`ARL_ID`) REFERENCES `AUTOMATION_REQUEST_LIBRARY` (`ARL_ID`);

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('bsiri', 'Add a Project fk to the AutomationRequestLibrary', NOW(), 'Add Column', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-519-automation-request-library-4', '2.0.5', '3:245b79ba9eaa831942ab29d9cf2b13b3', 440);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-519-automation-request-library-5::bsiri::(Checksum: 3:6fb84c3bc45cccef4e364ecbccd7f93f)
--  Create one such library for each existing projects
-- create the libraries

      insert into AUTOMATION_REQUEST_LIBRARY (ARL_ID)
      select p.PROJECT_ID from PROJECT p;

-- attachments, step 1 :
      -- create a ranking table, akin to what would ROW_NUMBER() order by id desc would say

      create table ARL_RANK as
      select alib.arl_id, count(alib2.arl_id)  as ranking
      from AUTOMATION_REQUEST_LIBRARY alib,
      AUTOMATION_REQUEST_LIBRARY alib2
      where alib.arl_id <= alib2.arl_id
      group by alib.arl_id
      order by ranking asc;

-- attachments, step 2 :
      -- create a table that pairs library ids with predictable, consecutive attachment_list_ids using the rank
      -- calculated earlier

      create table ARL_ATTACHLIST_PAIRING as
      select arl.arl_id, (select max(al.attachment_list_id) from ATTACHMENT_LIST al) + arl.ranking as attachment_list_id
      from ARL_RANK arl;

-- attachments, step 3 :
      -- insert the attachment lists and update fk in the automation request library
      insert into ATTACHMENT_LIST(ATTACHMENT_LIST_ID)
      select pair.attachment_list_id from ARL_ATTACHLIST_PAIRING pair;

update AUTOMATION_REQUEST_LIBRARY arl
      set ATTACHMENT_LIST_ID = (select pair.attachment_list_id from ARL_ATTACHLIST_PAIRING pair where pair.arl_id = arl.arl_id);

-- attachments, step 4 and final :
      -- drop the temporary tables

      drop table ARL_ATTACHLIST_PAIRING;

drop table ARL_RANK;

-- wire the project to the ARL library

      update PROJECT P
      set ARL_ID = PROJECT_ID;

-- insert the acl object identities
      insert into ACL_OBJECT_IDENTITY(IDENTITY, CLASS_ID)
      select arl.arl_id, 7 from AUTOMATION_REQUEST_LIBRARY arl;

-- add the user/team permissions in ACL_RESPONSIBILITY_SCOPE_ENTRY
      -- each user will receive the same acl_group on each arl library than on the project it depends on
      -- (this last sentence is the idea behind the auto join on acl_object_identity in this query)
      insert into ACL_RESPONSIBILITY_SCOPE_ENTRY(party_id, acl_group_id, object_identity_id)
      select distinct arse.party_id, arse.acl_group_id, arl_oid.id
      from ACL_RESPONSIBILITY_SCOPE_ENTRY arse
      inner join ACL_OBJECT_IDENTITY oid on (arse.object_identity_id = oid.id and oid.class_id = 1)
      inner join ACL_OBJECT_IDENTITY arl_oid on (oid.identity = arl_oid.identity and arl_oid.class_id = 7);

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('bsiri', 'Create one such library for each existing projects', NOW(), 'Custom SQL', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-519-automation-request-library-5', '2.0.5', '3:6fb84c3bc45cccef4e364ecbccd7f93f', 441);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-510-add-roles-automation::aboittiaux::(Checksum: 3:ab8e4f0bb3b90cc552475eb1645e7cd0)
insert into CORE_PARTY_AUTHORITY(PARTY_ID, AUTHORITY)
      select distinct cu.PARTY_ID, 'ROLE_TF_FUNCTIONAL_TESTER' from CORE_USER cu
      left join CORE_PARTY_AUTHORITY cpa on cu.PARTY_ID = cpa.PARTY_ID
      left join CORE_GROUP_MEMBER ctm on ctm.PARTY_ID = cu.PARTY_ID
      where cpa.AUTHORITY is null and ctm.GROUP_ID = 2;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('aboittiaux', '', NOW(), 'Custom SQL', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-510-add-roles-automation', '2.0.5', '3:ab8e4f0bb3b90cc552475eb1645e7cd0', 442);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-524-automation-workflow-by-project::jprioux::(Checksum: 3:b85a3cae93cd973c546f5efc43961885)
--  add a boolean in project table to activate or not the automation workflow
ALTER TABLE `PROJECT` ADD `ALLOW_AUTOMATION_WORKFLOW` TINYINT(1) NOT NULL DEFAULT 0;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('jprioux', 'add a boolean in project table to activate or not the automation workflow', NOW(), 'Add Column', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-524-automation-workflow-by-project', '2.0.5', '3:b85a3cae93cd973c546f5efc43961885', 443);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-create-auth-users::bsiri::(Checksum: 3:2641b5927bdbb5fe16ab3e3ec5e0c253)
--  add the missing entries in AUTH_USER for users that only exist in CORE_USER (eg a user created by LDAP)
insert into AUTH_USER (login, password, active)
      select cu.LOGIN, '', cu.active
      from CORE_USER cu
      left join AUTH_USER au on cu.login = au.login
      where au.login is null;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('bsiri', 'add the missing entries in AUTH_USER for users that only exist in CORE_USER (eg a user created by LDAP)', NOW(), 'Custom SQL', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-create-auth-users', '2.0.5', '3:2641b5927bdbb5fe16ab3e3ec5e0c253', 444);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-Mantis-7833::jprioux::(Checksum: 3:2a6554aaf36c544fe58930b1d45789be)
--  Increase remote project id limit to 100 for redmine bt project keys
ALTER TABLE `REQUIREMENT_SYNC_EXTENDER` MODIFY `REMOTE_PROJECT_ID` VARCHAR(100);

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('jprioux', 'Increase remote project id limit to 100 for redmine bt project keys', NOW(), 'Modify data type', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-Mantis-7833', '2.0.5', '3:2a6554aaf36c544fe58930b1d45789be', 445);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-536-autoexec-gherkin-1::bsiri::(Checksum: 3:7ed1740df7a7a5a0426a0b898568163e)
--  Add a flag to the test automation project that tells whether it is able to run Gherkin tests.
ALTER TABLE `TEST_AUTOMATION_PROJECT` ADD `CAN_RUN_GHERKIN` TINYINT(1) NOT NULL DEFAULT 0;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('bsiri', 'Add a flag to the test automation project that tells whether it is able to run Gherkin tests.', NOW(), 'Add Column', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-536-autoexec-gherkin-1', '2.0.5', '3:7ed1740df7a7a5a0426a0b898568163e', 446);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-543-third-party-server-1::bsiri::(Checksum: 3:76d1eb414a1cdea7e0f2ce5b02df7c31)
--  Create the table THIRD_PARTY_SERVER
CREATE TABLE `THIRD_PARTY_SERVER` (`SERVER_ID` BIGINT AUTO_INCREMENT NOT NULL, `NAME` VARCHAR(50) NOT NULL, `URL` VARCHAR(400) NOT NULL, `AUTH_POLICY` VARCHAR(30) DEFAULT 'USER' NULL, `AUTH_PROTOCOL` VARCHAR(30) DEFAULT 'BASIC_AUTH' NOT NULL, CONSTRAINT `PK_THIRD_PARTY_SERVER` PRIMARY KEY (`SERVER_ID`));

ALTER TABLE `THIRD_PARTY_SERVER` COMMENT = 'base table for third party servers';

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('bsiri', 'Create the table THIRD_PARTY_SERVER', NOW(), 'Create Table', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-543-third-party-server-1', '2.0.5', '3:76d1eb414a1cdea7e0f2ce5b02df7c31', 447);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-543-third-party-server-2::bsiri::(Checksum: 3:2fbff3a4f50f14a818edf08207a3c879)
--  migrate data from table BUGTRACKER to table THIRD_PARTY_SERVER
insert into THIRD_PARTY_SERVER(SERVER_ID, NAME, URL, AUTH_POLICY, AUTH_PROTOCOL)
      select BUGTRACKER_ID, NAME, URL, AUTH_POLICY, AUTH_PROTOCOL
      from BUGTRACKER;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('bsiri', 'migrate data from table BUGTRACKER to table THIRD_PARTY_SERVER', NOW(), 'Custom SQL', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-543-third-party-server-2', '2.0.5', '3:2fbff3a4f50f14a818edf08207a3c879', 448);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-543-third-party-server-3::bsiri::(Checksum: 3:ac8c104ca3c5031d05a07833278e39bf)
--  Drop the now unused columns from BUGTRACKER and create the FK from BUGTRACKER to THIRD_PARTY_SERVER
ALTER TABLE `BUGTRACKER` DROP COLUMN `NAME`;

ALTER TABLE `BUGTRACKER` DROP COLUMN `URL`;

ALTER TABLE `BUGTRACKER` DROP COLUMN `AUTH_POLICY`;

ALTER TABLE `BUGTRACKER` DROP COLUMN `AUTH_PROTOCOL`;

ALTER TABLE `BUGTRACKER` ADD CONSTRAINT `fk_bugtracker_third_party_server` FOREIGN KEY (`BUGTRACKER_ID`) REFERENCES `THIRD_PARTY_SERVER` (`SERVER_ID`) ON DELETE CASCADE;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('bsiri', 'Drop the now unused columns from BUGTRACKER and create the FK from BUGTRACKER to THIRD_PARTY_SERVER', NOW(), 'Drop Column (x4), Add Foreign Key Constraint', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-543-third-party-server-3', '2.0.5', '3:ac8c104ca3c5031d05a07833278e39bf', 449);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-543-third-party-server-4::bsiri::(Checksum: 3:4139d4e521c3b5dd91b0fc95e793049f)
--  change the foreign key stored_credentials -> bugtracker to stored_credentials -> third_party_server
ALTER TABLE `STORED_CREDENTIALS` DROP FOREIGN KEY `fk_stored_credentials_authenticated_server`;

CREATE INDEX `idx_fk_stored_credentials_authenticated_server` ON `STORED_CREDENTIALS`(`AUTHENTICATED_SERVER`);

ALTER TABLE `STORED_CREDENTIALS` ADD CONSTRAINT `fk_stored_credentials_authenticated_server` FOREIGN KEY (`AUTHENTICATED_SERVER`) REFERENCES `THIRD_PARTY_SERVER` (`SERVER_ID`) ON DELETE CASCADE;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('bsiri', 'change the foreign key stored_credentials -> bugtracker to stored_credentials -> third_party_server', NOW(), 'Drop Foreign Key Constraint, Create Index, Add Foreign Key Constraint', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-543-third-party-server-4', '2.0.5', '3:4139d4e521c3b5dd91b0fc95e793049f', 450);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-534-third-party-server-5-mysql::bsiri::(Checksum: 3:2736395d878bbb75f081eb08e2710f86)
--  For Mysql / Maria DB, remove the autoincrement on bugtracker_id
set foreign_key_checks=0;

alter table BUGTRACKER modify column BUGTRACKER_ID BIGINT not null;

set foreign_key_checks=1;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('bsiri', 'For Mysql / Maria DB, remove the autoincrement on bugtracker_id', NOW(), 'Custom SQL', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-534-third-party-server-5-mysql', '2.0.5', '3:2736395d878bbb75f081eb08e2710f86', 451);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-512-scm-server-management::jlor::(Checksum: 3:120666e6aa77c32bf5ad6c000dc7520a)
--  Add new table for scm (source code management) server.
CREATE TABLE `SCM_SERVER` (`SERVER_ID` BIGINT NOT NULL, `KIND` VARCHAR(30) NOT NULL, CONSTRAINT `PK_SCM_SERVER` PRIMARY KEY (`SERVER_ID`));

ALTER TABLE `SCM_SERVER` ADD CONSTRAINT `fk_scm_server_third_party_server` FOREIGN KEY (`SERVER_ID`) REFERENCES `THIRD_PARTY_SERVER` (`SERVER_ID`) ON DELETE CASCADE;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('jlor', 'Add new table for scm (source code management) server.', NOW(), 'Create Table, Add Foreign Key Constraint', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-512-scm-server-management', '2.0.5', '3:120666e6aa77c32bf5ad6c000dc7520a', 452);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-512-scm-repository-management::jlor::(Checksum: 3:aa001ff7e8ea43ea0d388358a08a6d5c)
--  Add new table for scm (source code management) repository.
CREATE TABLE `SCM_REPOSITORY` (`SCM_REPOSITORY_ID` BIGINT AUTO_INCREMENT NOT NULL, `SERVER_ID` BIGINT NOT NULL, `NAME` VARCHAR(255) NOT NULL, `REPOSITORY_PATH` VARCHAR(255) NOT NULL, `WORKING_FOLDER_PATH` VARCHAR(255) NULL, `WORKING_BRANCH` VARCHAR(255) NOT NULL, CONSTRAINT `PK_SCM_REPOSITORY` PRIMARY KEY (`SCM_REPOSITORY_ID`), CONSTRAINT `fk_scm_repository_scm_server` FOREIGN KEY (`SERVER_ID`) REFERENCES SCM_SERVER(SERVER_ID));

ALTER TABLE `SCM_REPOSITORY` ADD UNIQUE (`NAME`, `SERVER_ID`);

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('jlor', 'Add new table for scm (source code management) repository.', NOW(), 'Create Table, Add Unique Constraint', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-512-scm-repository-management', '2.0.5', '3:aa001ff7e8ea43ea0d388358a08a6d5c', 453);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-SQTM-512-project-scm-repository-binding::jlor::(Checksum: 3:9b16e82644b87b3692a80bce6e53b4cb)
--  Add foreign key in project table to reference a scm (source code management) repository.
ALTER TABLE `PROJECT` ADD `SCM_REPOSITORY_ID` BIGINT;

ALTER TABLE `PROJECT` ADD CONSTRAINT `fk_project_scm_repository` FOREIGN KEY (`SCM_REPOSITORY_ID`) REFERENCES `SCM_REPOSITORY` (`SCM_REPOSITORY_ID`);

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('jlor', 'Add foreign key in project table to reference a scm (source code management) repository.', NOW(), 'Add Column', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-SQTM-512-project-scm-repository-binding', '2.0.5', '3:9b16e82644b87b3692a80bce6e53b4cb', 454);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml::tm-1.19.0-Mantis-7547::jprioux::(Checksum: 3:19cf83bd7a0118717487ca10078f58d9)
--  Increase remote req id limit to 50 for jira
ALTER TABLE `REQUIREMENT_SYNC_EXTENDER` MODIFY `REMOTE_REQ_ID` VARCHAR(50);

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('jprioux', 'Increase remote req id limit to 50 for jira', NOW(), 'Modify data type', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.19.0.xml', 'tm-1.19.0-Mantis-7547', '2.0.5', '3:19cf83bd7a0118717487ca10078f58d9', 455);

--  Release Database Lock
--  Release Database Lock
