--  *********************************************************************
--  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.9.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.9.0.xml::tm-1.9.0::flaurens::(Checksum: 3:89b6f708853721fd664dabb32c4cc4e3)
--  Update TM database version number
UPDATE `CORE_CONFIG` SET `VALUE` = '1.9.0' WHERE STR_KEY = 'squashtest.tm.database.version';

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('flaurens', '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.9.0.xml', 'tm-1.9.0', '2.0.5', '3:89b6f708853721fd664dabb32c4cc4e3', 300);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.9.0.xml::tm-1.9.0.feature-3138-1::flaurens::(Checksum: 3:fb92b061d00061589d121c2caf27ed4e)
--  Adding columns to order descendants in node relationship tables
ALTER TABLE `CLN_RELATIONSHIP` ADD `CONTENT_ORDER` INT;

ALTER TABLE `RLN_RELATIONSHIP` ADD `CONTENT_ORDER` INT;

ALTER TABLE `TCLN_RELATIONSHIP` ADD `CONTENT_ORDER` INT;

ALTER TABLE `REQUIREMENT_LIBRARY_CONTENT` ADD `CONTENT_ORDER` INT;

ALTER TABLE `TEST_CASE_LIBRARY_CONTENT` ADD `CONTENT_ORDER` INT;

ALTER TABLE `CAMPAIGN_LIBRARY_CONTENT` ADD `CONTENT_ORDER` INT;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('flaurens', 'Adding columns to order descendants in node relationship tables', NOW(), 'Add Column (x6)', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.9.0.xml', 'tm-1.9.0.feature-3138-1', '2.0.5', '3:fb92b061d00061589d121c2caf27ed4e', 301);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.9.0.xml::tm-1.9.0.feature-3138-2::jsimon::(Checksum: 3:77ca853b3481ee33b5ba05a49009ba66)
--  Creating default order which is identical with the alphabetical order
--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.9.0.xml::tm-1.9.0.feature-3138-2::flaurens::(Checksum: 3:70d082bcf1d9413f08fb96affa048467)
--  Creating default order which is identical with the alphabetical order
create table TEMP_CLN_CONTENT_ORDER(
        CONTENT_ORDER BIGINT NOT NULL, 
        ANCESTOR_ID BIGINT NOT NULL, 
        DESCENDANT_ID BIGINT NOT NULL, 
        DUMMY BIGINT NOT NULL
      );

insert into TEMP_CLN_CONTENT_ORDER (CONTENT_ORDER, ANCESTOR_ID, DESCENDANT_ID, DUMMY)
      select 
        if(@prevtcs=ANCESTOR_ID, @rownum:=@rownum+1, @rownum:=0) as RANK,
        clnr.ANCESTOR_ID, 
        clnr.DESCENDANT_ID, 
        (@prevtcs:=ANCESTOR_ID)
      from ( 
      	select cr.ancestor_id, cr.descendant_id 
      	from CLN_RELATIONSHIP cr
        join CAMPAIGN_LIBRARY_NODE cln on cr.DESCENDANT_ID = cln.CLN_ID 
        order by cr.ANCESTOR_ID, cln.NAME
       ) as clnr,
        (SELECT @rownum:=0) r, 
        (SELECT @prevtcs:=0) s;

insert into TEMP_CLN_CONTENT_ORDER (CONTENT_ORDER, ANCESTOR_ID, DESCENDANT_ID, DUMMY)
      select 
        if(@prevtcs=LIBRARY_ID, @rownum:=@rownum+1, @rownum:=0) as RANK,
        clnrr.LIBRARY_ID, clnrr.CONTENT_ID, (@prevtcs:=LIBRARY_ID)
      from (
      	select clc.LIBRARY_ID, clc.CONTENT_ID 
      	from CAMPAIGN_LIBRARY_CONTENT clc
        join CAMPAIGN_LIBRARY_NODE cln on clc.CONTENT_ID = cln.CLN_ID
        order by clc.LIBRARY_ID, cln.NAME
        ) as clnrr,
        (SELECT @rownum:=0) r, 
        (SELECT @prevtcs:=0) s;

update CLN_RELATIONSHIP
      set CONTENT_ORDER = (
        select TEMP_CLN_CONTENT_ORDER.CONTENT_ORDER
        from TEMP_CLN_CONTENT_ORDER
        where TEMP_CLN_CONTENT_ORDER.ANCESTOR_ID = CLN_RELATIONSHIP.ANCESTOR_ID
          and TEMP_CLN_CONTENT_ORDER.DESCENDANT_ID = CLN_RELATIONSHIP.DESCENDANT_ID
      );

update CAMPAIGN_LIBRARY_CONTENT
      set CONTENT_ORDER = (
        select TEMP_CLN_CONTENT_ORDER.CONTENT_ORDER
        from TEMP_CLN_CONTENT_ORDER
        where TEMP_CLN_CONTENT_ORDER.ANCESTOR_ID = CAMPAIGN_LIBRARY_CONTENT.LIBRARY_ID
          and TEMP_CLN_CONTENT_ORDER.DESCENDANT_ID = CAMPAIGN_LIBRARY_CONTENT.CONTENT_ID
      );

drop table TEMP_CLN_CONTENT_ORDER;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('flaurens', 'Creating default order which is identical with the alphabetical order', 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.9.0.xml', 'tm-1.9.0.feature-3138-2', '2.0.5', '3:70d082bcf1d9413f08fb96affa048467', 302);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.9.0.xml::tm-1.9.0.feature-3138-3::flaurens::(Checksum: 3:e7a212429273aed825eb0cbcaf5805d7)
--  Creating default order which is identical with the alphabetical order
--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.9.0.xml::tm-1.9.0.feature-3138-4::jsimon::(Checksum: 3:fe66b4c9da37de06e263e64be83bb7fc)
--  Creating default order which is identical with the alphabetical order
--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.9.0.xml::tm-1.9.0.feature-3138-4::flaurens::(Checksum: 3:23d673afa932d2662822b0c0ebb153c4)
--  Creating default order which is identical with the alphabetical order
create table TEMP_RLN_CONTENT_ORDER(CONTENT_ORDER BIGINT NOT NULL, ANCESTOR_ID BIGINT NOT NULL, DESCENDANT_ID BIGINT NOT
	      NULL, DUMMY BIGINT NOT NULL);

create table TMP_MAP_RLN_RESOURCE(RLN_ID BIGINT NOT NULL, 
		NAME VARCHAR(255));

insert into TMP_MAP_RLN_RESOURCE(rln_id, name)
	select f.rln_id, res.name 
	from REQUIREMENT_FOLDER f
	inner join RESOURCE res on f.res_id = res.res_id;

insert into TMP_MAP_RLN_RESOURCE(rln_id,  name)
	select r.rln_id,  res.name
	from REQUIREMENT r
	inner join RESOURCE res on  r.current_version_id = res.res_id;

insert into TEMP_RLN_CONTENT_ORDER (CONTENT_ORDER, ANCESTOR_ID, DESCENDANT_ID, DUMMY)
	      select if(@prevtcs=ANCESTOR_ID,
	      @rownum:=@rownum+1,
	      @rownum:=0) as RANK,
	      rlnr.ANCESTOR_ID, rlnr.DESCENDANT_ID, (@prevtcs:=ANCESTOR_ID)
	      from (
	      	select rln.ancestor_id, rln.descendant_id 
	      	from RLN_RELATIONSHIP rln
	      	inner join TMP_MAP_RLN_RESOURCE tmp on rln.descendant_id = tmp.rln_id 
	      	order by rln.ancestor_id, tmp.name  
	      ) as rlnr,
	      (SELECT @rownum:=0) r, (SELECT @prevtcs:=0) s;

insert into TEMP_RLN_CONTENT_ORDER (CONTENT_ORDER, ANCESTOR_ID, DESCENDANT_ID, DUMMY)
	      select if(@prevtcs=LIBRARY_ID,
	      @rownum:=@rownum+1,
	      @rownum:=0) as RANK,
	      rlnr.LIBRARY_ID, rlnr.CONTENT_ID, (@prevtcs:=rlnr.LIBRARY_ID)
	      from (
	      	select rlc.library_id, rlc.content_id 
	      	from REQUIREMENT_LIBRARY_CONTENT rlc
	      	inner join TMP_MAP_RLN_RESOURCE tmp on rlc.content_id = tmp.rln_id
	      	order by rlc.library_id, tmp.name
	      ) as rlnr,
		(SELECT @rownum:=0) r, (SELECT @prevtcs:=0) s;

update RLN_RELATIONSHIP
	      set CONTENT_ORDER = (select TEMP_RLN_CONTENT_ORDER.CONTENT_ORDER
	      from TEMP_RLN_CONTENT_ORDER
	      where TEMP_RLN_CONTENT_ORDER.ANCESTOR_ID = RLN_RELATIONSHIP.ANCESTOR_ID
	      and TEMP_RLN_CONTENT_ORDER.DESCENDANT_ID = RLN_RELATIONSHIP.DESCENDANT_ID);

update REQUIREMENT_LIBRARY_CONTENT
	      set CONTENT_ORDER = (select TEMP_RLN_CONTENT_ORDER.CONTENT_ORDER
	      from TEMP_RLN_CONTENT_ORDER
	      where TEMP_RLN_CONTENT_ORDER.ANCESTOR_ID = REQUIREMENT_LIBRARY_CONTENT.LIBRARY_ID
	      and TEMP_RLN_CONTENT_ORDER.DESCENDANT_ID = REQUIREMENT_LIBRARY_CONTENT.CONTENT_ID);

drop table TEMP_RLN_CONTENT_ORDER;

drop table TMP_MAP_RLN_RESOURCE;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('flaurens', 'Creating default order which is identical with the alphabetical order', 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.9.0.xml', 'tm-1.9.0.feature-3138-4', '2.0.5', '3:23d673afa932d2662822b0c0ebb153c4', 303);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.9.0.xml::tm-1.9.0.feature-3138-5::flaurens::(Checksum: 3:d72728a5247af5f160a9b2bf6ea46e06)
--  Creating default order which is identical with the alphabetical order
--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.9.0.xml::tm-1.9.0.feature-3138-6::jsimon::(Checksum: 3:e41cebe2243a27747d56b644dc107adb)
--  Creating default order which is identical with the alphabetical order
--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.9.0.xml::tm-1.9.0.feature-3138-6::flaurens::(Checksum: 3:0aa920840e862570d6ed68203c8e9c61)
--  Creating default order which is identical with the alphabetical order
create table TEMP_TCLN_CONTENT_ORDER(CONTENT_ORDER BIGINT NOT NULL, ANCESTOR_ID BIGINT NOT NULL, DESCENDANT_ID BIGINT NOT
      NULL, DUMMY BIGINT NOT NULL);

insert into TEMP_TCLN_CONTENT_ORDER (CONTENT_ORDER, ANCESTOR_ID, DESCENDANT_ID, DUMMY)
      select if(@prevtcs=ANCESTOR_ID,
      @rownum:=@rownum+1,
      @rownum:=0) as RANK,
      tclnr.ANCESTOR_ID, tclnr.DESCENDANT_ID, (@prevtcs:=ANCESTOR_ID)
      from (
      select tr.ancestor_id, tr.descendant_id 
      from TCLN_RELATIONSHIP tr
      join TEST_CASE_LIBRARY_NODE tcln on tr.DESCENDANT_ID = tcln.TCLN_ID
      order by tr.ancestor_id, tcln.name
      ) as tclnr,
      (SELECT @rownum:=0) r, (SELECT @prevtcs:=0) s;

insert into TEMP_TCLN_CONTENT_ORDER (CONTENT_ORDER, ANCESTOR_ID, DESCENDANT_ID, DUMMY)
      select if(@prevtcs=LIBRARY_ID,
      @rownum:=@rownum+1,
      @rownum:=0) as RANK,
      tclnr.LIBRARY_ID, tclnr.CONTENT_ID, (@prevtcs:=LIBRARY_ID)
      from (
      	select tc.library_id, tc.content_id
      	from TEST_CASE_LIBRARY_CONTENT tc      
      	join TEST_CASE_LIBRARY_NODE tcln on tc.CONTENT_ID = tcln.TCLN_ID
      	order by tc.library_id, tcln.name
      ) as tclnr,
      (SELECT @rownum:=0) r, (SELECT @prevtcs:=0) s;

update TCLN_RELATIONSHIP
      set CONTENT_ORDER = (select TEMP_TCLN_CONTENT_ORDER.CONTENT_ORDER
      from TEMP_TCLN_CONTENT_ORDER
      where TEMP_TCLN_CONTENT_ORDER.ANCESTOR_ID = TCLN_RELATIONSHIP.ANCESTOR_ID
      and TEMP_TCLN_CONTENT_ORDER.DESCENDANT_ID = TCLN_RELATIONSHIP.DESCENDANT_ID);

update TEST_CASE_LIBRARY_CONTENT
      set CONTENT_ORDER = (select TEMP_TCLN_CONTENT_ORDER.CONTENT_ORDER
      from TEMP_TCLN_CONTENT_ORDER
      where TEMP_TCLN_CONTENT_ORDER.ANCESTOR_ID = TEST_CASE_LIBRARY_CONTENT.LIBRARY_ID
      and TEMP_TCLN_CONTENT_ORDER.DESCENDANT_ID = TEST_CASE_LIBRARY_CONTENT.CONTENT_ID);

drop table TEMP_TCLN_CONTENT_ORDER;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('flaurens', 'Creating default order which is identical with the alphabetical order', 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.9.0.xml', 'tm-1.9.0.feature-3138-6', '2.0.5', '3:0aa920840e862570d6ed68203c8e9c61', 304);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.9.0.xml::tm-1.9.0.feature-3138-7::flaurens::(Checksum: 3:f87847f25964c228c1f9f490447d43e5)
--  Creating default order which is identical with the alphabetical order
--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.9.0.xml::tm-1.9.0.feature-3138-8::flaurens::(Checksum: 3:791def7c4c4c0ba5de392094e2566dc7)
ALTER TABLE `REQUIREMENT_VERSION_COVERAGE` MODIFY `VERIFIED_REQ_VERSION_ID` BIGINT NULL;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('flaurens', '', NOW(), 'Drop 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.9.0.xml', 'tm-1.9.0.feature-3138-8', '2.0.5', '3:791def7c4c4c0ba5de392094e2566dc7', 305);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.9.0.xml::tm-1.9.0.feature-3211-1::flaurens::(Checksum: 3:5ff38e07ec4100e97110b6a92e3de8f2)
CREATE TABLE `DISABLED_EXECUTION_STATUS` (`CL_ID` BIGINT NOT NULL, `EXECUTION_STATUS` VARCHAR(255) NOT NULL, CONSTRAINT `FK_DISABLED_EXEC_STATUS_CL_ID` FOREIGN KEY (`CL_ID`) REFERENCES CAMPAIGN_LIBRARY(CL_ID));

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('flaurens', '', 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.9.0.xml', 'tm-1.9.0.feature-3211-1', '2.0.5', '3:5ff38e07ec4100e97110b6a92e3de8f2', 306);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.9.0.xml::tm-1.9.0.feature-3211-2::flaurens::(Checksum: 3:26052fb408d086effe3a014b8a09213a)
--  Inserting default disabled execution statuses for existing libraries
insert into DISABLED_EXECUTION_STATUS (CL_ID, EXECUTION_STATUS)
	select cl_id, 'ERROR' from CAMPAIGN_LIBRARY;

insert into DISABLED_EXECUTION_STATUS (CL_ID, EXECUTION_STATUS)
	select cl_id, 'WARNING' from CAMPAIGN_LIBRARY;

insert into DISABLED_EXECUTION_STATUS (CL_ID, EXECUTION_STATUS)
	select cl_id, 'NOT_RUN' from CAMPAIGN_LIBRARY;

insert into DISABLED_EXECUTION_STATUS (CL_ID, EXECUTION_STATUS)
	select cl_id, 'SETTLED' from CAMPAIGN_LIBRARY;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('flaurens', 'Inserting default disabled execution statuses for existing libraries', 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.9.0.xml', 'tm-1.9.0.feature-3211-2', '2.0.5', '3:26052fb408d086effe3a014b8a09213a', 307);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.9.0.xml::tm-1.9.0-issue-3236-01::flaurens::(Checksum: 3:729c2bd9779407fdac179500120ac41d)
update DENORMALIZED_FIELD_VALUE
		set FIELD_TYPE = 'CF'
		where FIELD_TYPE = '';

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('flaurens', '', 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.9.0.xml', 'tm-1.9.0-issue-3236-01', '2.0.5', '3:729c2bd9779407fdac179500120ac41d', 308);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.9.0.xml::tm-1.9.0-issue--01::flaurens::(Checksum: 3:b648fe9256fe932650a53bc207e9b1d7)
ALTER TABLE `ACTION_TEST_STEP` MODIFY `ACTION` LONGTEXT NULL;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('flaurens', '', NOW(), 'Drop 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.9.0.xml', 'tm-1.9.0-issue--01', '2.0.5', '3:b648fe9256fe932650a53bc207e9b1d7', 309);

--  Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.9.0.xml::tm-1.9.0-issue-3140-01::mpagnon::(Checksum: 3:5ea9821a2262ebec751e750545bb7a5a)
create table TEMP_VS(
          RVC_ID BIGINT NOT NULL,
          TS_ID BIGINT NOT NULL
        );

insert into TEMP_VS(RVC_ID, TS_ID)
        select vs.REQUIREMENT_VERSION_COVERAGE_ID, vs.TEST_STEP_ID
        from VERIFYING_STEPS as vs
        group by vs.REQUIREMENT_VERSION_COVERAGE_ID, vs.TEST_STEP_ID;

delete from VERIFYING_STEPS;

insert into  VERIFYING_STEPS (REQUIREMENT_VERSION_COVERAGE_ID, TEST_STEP_ID)
        select RVC_ID , TS_ID
        from TEMP_VS;

drop table TEMP_VS;

INSERT INTO `DATABASECHANGELOG` (`AUTHOR`, `COMMENTS`, `DATEEXECUTED`, `DESCRIPTION`, `EXECTYPE`, `FILENAME`, `ID`, `LIQUIBASE`, `MD5SUM`, `ORDEREXECUTED`) VALUES ('mpagnon', '', 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.9.0.xml', 'tm-1.9.0-issue-3140-01', '2.0.5', '3:5ea9821a2262ebec751e750545bb7a5a', 310);

--  Release Database Lock
--  Release Database Lock
