--  *********************************************************************
--  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.16.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.16.0.xml::tm-1.16.0::jprioux::(Checksum: 3:975a078e1c0967a9ce1adf42f328e04b)
--  Update TM database version number
UPDATE `CORE_CONFIG` SET `VALUE` = '1.16.0' WHERE STR_KEY = 'squashtest.tm.database.version';

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('jprioux', '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.16.0.xml', 'tm-1.16.0', '2.0.5', '3:975a078e1c0967a9ce1adf42f328e04b', 402);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.16.0.xml::tm-1.16.0-feature-6763::jprioux::(Checksum: 3:a839f67f0e2cf6a0b463d183582114ad)
--  column for last connected on
ALTER TABLE `CORE_USER` ADD `LAST_CONNECTED_ON` DATETIME;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('jprioux', 'column for last connected on', 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.16.0.xml', 'tm-1.16.0-feature-6763', '2.0.5', '3:a839f67f0e2cf6a0b463d183582114ad', 403);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.16.0.xml::tm-1.16.0-feature-6799::jlor::(Checksum: 3:78f26ca715837f5976eb2d37bd9494fb)
CREATE TABLE `REQUIREMENT_VERSION_LINK_TYPE` (`TYPE_ID` BIGINT AUTO_INCREMENT NOT NULL, `ROLE_1` VARCHAR(50) NULL, `ROLE_1_CODE` VARCHAR(30) NULL, `ROLE_2` VARCHAR(50) NULL, `ROLE_2_CODE` VARCHAR(30) NULL, `IS_DEFAULT` TINYINT(1) DEFAULT 0 NOT NULL, CONSTRAINT `PK_REQUIREMENT_VERSION_LINK_TYPE` PRIMARY KEY (`TYPE_ID`));

CREATE TABLE `REQUIREMENT_VERSION_LINK` (`LINK_ID` BIGINT AUTO_INCREMENT NOT NULL, `LINK_TYPE_ID` BIGINT NOT NULL, `LINK_DIRECTION` TINYINT(1) DEFAULT 0 NOT NULL, `REQUIREMENT_VERSION_ID` BIGINT NOT NULL, `RELATED_REQUIREMENT_VERSION_ID` BIGINT NOT NULL, CONSTRAINT `PK_REQUIREMENT_VERSION_LINK` PRIMARY KEY (`LINK_ID`), CONSTRAINT `fk_requirement_version_link_related_requirement_version_id` FOREIGN KEY (`RELATED_REQUIREMENT_VERSION_ID`) REFERENCES REQUIREMENT_VERSION(RES_ID), CONSTRAINT `fk_req_version_link_req_version_link_type_link_type_id` FOREIGN KEY (`LINK_TYPE_ID`) REFERENCES REQUIREMENT_VERSION_LINK_TYPE(TYPE_ID), CONSTRAINT `fk_requirement_version_link_requirement_version_id` FOREIGN KEY (`REQUIREMENT_VERSION_ID`) REFERENCES REQUIREMENT_VERSION(RES_ID));

INSERT INTO `REQUIREMENT_VERSION_LINK_TYPE` (`IS_DEFAULT`, `ROLE_1`, `ROLE_1_CODE`, `ROLE_2`, `ROLE_2_CODE`) VALUES (1, 'requirement-version.link.type.related', 'RELATED', 'requirement-version.link.type.related', 'RELATED');

INSERT INTO `REQUIREMENT_VERSION_LINK_TYPE` (`IS_DEFAULT`, `ROLE_1`, `ROLE_1_CODE`, `ROLE_2`, `ROLE_2_CODE`) VALUES (0, 'requirement-version.link.type.parent', 'PARENT', 'requirement-version.link.type.child', 'CHILD');

INSERT INTO `REQUIREMENT_VERSION_LINK_TYPE` (`IS_DEFAULT`, `ROLE_1`, `ROLE_1_CODE`, `ROLE_2`, `ROLE_2_CODE`) VALUES (0, 'requirement-version.link.type.duplicate', 'DUPLICATE', 'requirement-version.link.type.duplicate', 'DUPLICATE');

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('jlor', '', NOW(), 'Create Table (x2), Insert Row (x3)', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.16.0.xml', 'tm-1.16.0-feature-6799', '2.0.5', '3:78f26ca715837f5976eb2d37bd9494fb', 404);

--  Release Database Lock
--  Release Database Lock
