-- *********************************************************************
-- 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.4.0.xml
-- Ran at: 03/04/20 12:06
-- Against: SA@jdbc:h2:/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/incremental-upgrade-database/squash-tm
-- 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.4.0.xml::tm-1.4.0.00::gfouquet::(Checksum: 3:4ef18a63bbd3169cef35179fb8c91028)
-- Adds a TM database version number
UPDATE CORE_CONFIG SET STR_KEY = 'squashtest.tm.database.version', VALUE = '1.4.0' WHERE STR_KEY = 'squashtest.tm.database.version';

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('gfouquet', 'Adds a 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.4.0.xml', 'tm-1.4.0.00', '2.0.5', '3:4ef18a63bbd3169cef35179fb8c91028', 153);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0-feat-1109.01::gfouquet::(Checksum: 3:8f83c1af5962af42e68d6401ef310c9f)
-- Creates a table for Custom Fields
CREATE TABLE CUSTOM_FIELD (CF_ID BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL, FIELD_TYPE CHAR(3) NOT NULL, NAME VARCHAR(255) NOT NULL, LABEL VARCHAR(255) DEFAULT '' NOT NULL, OPTIONAL BOOLEAN DEFAULT TRUE NOT NULL, DEFAULT_VALUE VARCHAR(255), INPUT_TYPE CHAR(30) NOT NULL, CONSTRAINT pk_custom_field PRIMARY KEY (CF_ID));

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('gfouquet', 'Creates a table for Custom Fields', 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.4.0.xml', 'tm-1.4.0-feat-1109.01', '2.0.5', '3:8f83c1af5962af42e68d6401ef310c9f', 154);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0-feat-1109.02::gfouquet::(Checksum: 3:ec08ab8b8e2359f529da4a311a6c84ab)
-- Creates a table for Custom Fields Options
CREATE TABLE CUSTOM_FIELD_OPTION (CF_ID BIGINT NOT NULL, LABEL VARCHAR(255) NOT NULL, POSITION INT NOT NULL, CONSTRAINT fk_cf_option_cf FOREIGN KEY (CF_ID) REFERENCES CUSTOM_FIELD(CF_ID));

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('gfouquet', 'Creates a table for Custom Fields Options', 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.4.0.xml', 'tm-1.4.0-feat-1109.02', '2.0.5', '3:ec08ab8b8e2359f529da4a311a6c84ab', 155);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0-feat-1390.01::gfouquet::(Checksum: 3:cadfa5b3c7e141db73867b4bc8e98a18)
-- Creates a table for Custom Fields Binding
CREATE TABLE CUSTOM_FIELD_BINDING (CFB_ID BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL, CF_ID BIGINT NOT NULL, BOUND_ENTITY VARCHAR(30) NOT NULL, BOUND_PROJECT_ID BIGINT NOT NULL, POSITION INT, CONSTRAINT pk_cfb_option PRIMARY KEY (CFB_ID), CONSTRAINT fk_cfb_cf FOREIGN KEY (CF_ID) REFERENCES CUSTOM_FIELD(CF_ID), CONSTRAINT fk_cfb_bound_project FOREIGN KEY (BOUND_PROJECT_ID) REFERENCES PROJECT(PROJECT_ID));

ALTER TABLE CUSTOM_FIELD_BINDING ADD CONSTRAINT uc_cf_entity_proj_bnd UNIQUE (BOUND_PROJECT_ID, BOUND_ENTITY, CF_ID);

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('gfouquet', 'Creates a table for Custom Fields Binding', 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.4.0.xml', 'tm-1.4.0-feat-1390.01', '2.0.5', '3:cadfa5b3c7e141db73867b4bc8e98a18', 156);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0-feat-1390.02::gfouquet::(Checksum: 3:8fc5d161321c668c715d5e5a5be4bf90)
-- Creates a table for rendering locations of a bound custom field
CREATE TABLE CUSTOM_FIELD_RENDERING_LOCATION (CFB_ID BIGINT NOT NULL, RENDERING_LOCATION VARCHAR(30) NOT NULL, CONSTRAINT fk_cfb_render_loc_cfb FOREIGN KEY (CFB_ID) REFERENCES CUSTOM_FIELD_BINDING(CFB_ID));

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('gfouquet', 'Creates a table for rendering locations of a bound custom field', 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.4.0.xml', 'tm-1.4.0-feat-1390.02', '2.0.5', '3:8fc5d161321c668c715d5e5a5be4bf90', 157);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1513.01::mpagnon::(Checksum: 3:2b44c9ff7d0cf014f99833e33912a423)
-- Add property attachment list in library nodes, projects and libraries
ALTER TABLE TEST_CASE_LIBRARY_NODE ADD ATTACHMENT_LIST_ID BIGINT;

ALTER TABLE TEST_CASE_LIBRARY_NODE ADD CONSTRAINT fk_tcNode_attachment_list FOREIGN KEY (ATTACHMENT_LIST_ID) REFERENCES ATTACHMENT_LIST (ATTACHMENT_LIST_ID);

ALTER TABLE CAMPAIGN_LIBRARY_NODE ADD ATTACHMENT_LIST_ID BIGINT;

ALTER TABLE CAMPAIGN_LIBRARY_NODE ADD CONSTRAINT fk_campNode_attachment_list FOREIGN KEY (ATTACHMENT_LIST_ID) REFERENCES ATTACHMENT_LIST (ATTACHMENT_LIST_ID);

ALTER TABLE RESOURCE ADD ATTACHMENT_LIST_ID BIGINT;

ALTER TABLE RESOURCE ADD CONSTRAINT fk_resource_attachment_list FOREIGN KEY (ATTACHMENT_LIST_ID) REFERENCES ATTACHMENT_LIST (ATTACHMENT_LIST_ID);

ALTER TABLE PROJECT ADD ATTACHMENT_LIST_ID BIGINT;

ALTER TABLE PROJECT ADD CONSTRAINT fk_project_attachment_list FOREIGN KEY (ATTACHMENT_LIST_ID) REFERENCES ATTACHMENT_LIST (ATTACHMENT_LIST_ID);

ALTER TABLE REQUIREMENT_LIBRARY ADD ATTACHMENT_LIST_ID BIGINT;

ALTER TABLE REQUIREMENT_LIBRARY ADD CONSTRAINT fk_reqLib_attachment_list FOREIGN KEY (ATTACHMENT_LIST_ID) REFERENCES ATTACHMENT_LIST (ATTACHMENT_LIST_ID);

ALTER TABLE TEST_CASE_LIBRARY ADD ATTACHMENT_LIST_ID BIGINT;

ALTER TABLE TEST_CASE_LIBRARY ADD CONSTRAINT fk_tcLib_attachment_list FOREIGN KEY (ATTACHMENT_LIST_ID) REFERENCES ATTACHMENT_LIST (ATTACHMENT_LIST_ID);

ALTER TABLE CAMPAIGN_LIBRARY ADD ATTACHMENT_LIST_ID BIGINT;

ALTER TABLE CAMPAIGN_LIBRARY ADD CONSTRAINT fk_campLib_attachment_list FOREIGN KEY (ATTACHMENT_LIST_ID) REFERENCES ATTACHMENT_LIST (ATTACHMENT_LIST_ID);

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('mpagnon', 'Add property attachment list in library nodes, projects and libraries', NOW(), 'Add Column (x7)', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml', 'tm-1.4.0.feat-1513.01', '2.0.5', '3:2b44c9ff7d0cf014f99833e33912a423', 158);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1513.02::mpagnon::(Checksum: 3:1699dc3bd6443b42d5b84be37244fcdf)
-- Migrate existing attachment lists
update TEST_CASE_LIBRARY_NODE
			set ATTACHMENT_LIST_ID = (select TEST_CASE.ATTACHMENT_LIST_ID from TEST_CASE where TEST_CASE.TCLN_ID = TEST_CASE_LIBRARY_NODE.TCLN_ID);

update CAMPAIGN_LIBRARY_NODE
			set ATTACHMENT_LIST_ID = (select CAMPAIGN.ATTACHMENT_LIST_ID from CAMPAIGN where CAMPAIGN.CLN_ID = CAMPAIGN_LIBRARY_NODE.CLN_ID);

update RESOURCE
			set ATTACHMENT_LIST_ID = (select REQUIREMENT_VERSION.ATTACHMENT_LIST_ID from REQUIREMENT_VERSION where REQUIREMENT_VERSION.RES_ID = RESOURCE.RES_ID);

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('mpagnon', 'Migrate existing attachment lists', NOW(), 'Custom SQL (x3)', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml', 'tm-1.4.0.feat-1513.02', '2.0.5', '3:1699dc3bd6443b42d5b84be37244fcdf', 159);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1513.03::mpagnon::(Checksum: 3:9489cb2edd3dd5c64179ed2221a3e581)
-- Add attachment lists to test_case_folders
ALTER TABLE ATTACHMENT_LIST ADD TCLN_ID BIGINT;

ALTER TABLE ATTACHMENT_LIST ADD CONSTRAINT fk_tcln FOREIGN KEY (TCLN_ID) REFERENCES TEST_CASE_LIBRARY_NODE (TCLN_ID);

insert into ATTACHMENT_LIST (TCLN_ID)
			select TEST_CASE_FOLDER.TCLN_ID from TEST_CASE_FOLDER;

update TEST_CASE_LIBRARY_NODE 
			set ATTACHMENT_LIST_ID = (select ATTACHMENT_LIST.ATTACHMENT_LIST_ID from ATTACHMENT_LIST where ATTACHMENT_LIST.TCLN_ID = TEST_CASE_LIBRARY_NODE.TCLN_ID)
			where ATTACHMENT_LIST_ID is null;

ALTER TABLE ATTACHMENT_LIST DROP CONSTRAINT fk_tcln;

ALTER TABLE ATTACHMENT_LIST DROP COLUMN TCLN_ID;

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('mpagnon', 'Add attachment lists to test_case_folders', NOW(), 'Add Column, Custom SQL (x2), Drop Foreign Key Constraint, Drop Column', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml', 'tm-1.4.0.feat-1513.03', '2.0.5', '3:9489cb2edd3dd5c64179ed2221a3e581', 160);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1513.04::mpagnon::(Checksum: 3:9067e9a177ebc3d48e3ba6ee428dfa95)
-- Add attachment lists to campaign_folders
ALTER TABLE ATTACHMENT_LIST ADD CLN_ID BIGINT;

ALTER TABLE ATTACHMENT_LIST ADD CONSTRAINT fk_cln FOREIGN KEY (CLN_ID) REFERENCES CAMPAIGN_LIBRARY_NODE (CLN_ID);

insert into ATTACHMENT_LIST (CLN_ID)
			select CAMPAIGN_FOLDER.CLN_ID from CAMPAIGN_FOLDER;

update CAMPAIGN_LIBRARY_NODE 
			set ATTACHMENT_LIST_ID = (select ATTACHMENT_LIST.ATTACHMENT_LIST_ID from ATTACHMENT_LIST where ATTACHMENT_LIST.CLN_ID = CAMPAIGN_LIBRARY_NODE.CLN_ID)
			where ATTACHMENT_LIST_ID is null;

ALTER TABLE ATTACHMENT_LIST DROP CONSTRAINT fk_cln;

ALTER TABLE ATTACHMENT_LIST DROP COLUMN CLN_ID;

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('mpagnon', 'Add attachment lists to campaign_folders', NOW(), 'Add Column, Custom SQL (x2), Drop Foreign Key Constraint, Drop Column', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml', 'tm-1.4.0.feat-1513.04', '2.0.5', '3:9067e9a177ebc3d48e3ba6ee428dfa95', 161);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1513.05::mpagnon::(Checksum: 3:132d9664007ea9ef0be3785013bba662)
-- Add attachment lists to requirement folders
ALTER TABLE ATTACHMENT_LIST ADD RES_ID BIGINT;

ALTER TABLE ATTACHMENT_LIST ADD CONSTRAINT fk_sr FOREIGN KEY (RES_ID) REFERENCES RESOURCE (RES_ID);

insert into ATTACHMENT_LIST (RES_ID)
			select SIMPLE_RESOURCE.RES_ID from SIMPLE_RESOURCE;

update RESOURCE 
			set ATTACHMENT_LIST_ID = (select ATTACHMENT_LIST.ATTACHMENT_LIST_ID from ATTACHMENT_LIST where ATTACHMENT_LIST.RES_ID = RESOURCE.RES_ID)
			where ATTACHMENT_LIST_ID is null;

ALTER TABLE ATTACHMENT_LIST DROP CONSTRAINT fk_sr;

ALTER TABLE ATTACHMENT_LIST DROP COLUMN RES_ID;

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('mpagnon', 'Add attachment lists to requirement folders', NOW(), 'Add Column, Custom SQL (x2), Drop Foreign Key Constraint, Drop Column', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml', 'tm-1.4.0.feat-1513.05', '2.0.5', '3:132d9664007ea9ef0be3785013bba662', 162);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1513.06::mpagnon::(Checksum: 3:8f9980911439ce0cbb91a1cf37288805)
-- Add attachment lists to projects
ALTER TABLE ATTACHMENT_LIST ADD PROJECT_ID BIGINT;

ALTER TABLE ATTACHMENT_LIST ADD CONSTRAINT fk_project FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT (PROJECT_ID);

insert into ATTACHMENT_LIST (PROJECT_ID)
			select PROJECT.PROJECT_ID from PROJECT;

update PROJECT 
			set ATTACHMENT_LIST_ID = (select ATTACHMENT_LIST.ATTACHMENT_LIST_ID from ATTACHMENT_LIST where ATTACHMENT_LIST.PROJECT_ID = PROJECT.PROJECT_ID)
			where ATTACHMENT_LIST_ID is null;

ALTER TABLE ATTACHMENT_LIST DROP CONSTRAINT fk_project;

ALTER TABLE ATTACHMENT_LIST DROP COLUMN PROJECT_ID;

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('mpagnon', 'Add attachment lists to projects', NOW(), 'Add Column, Custom SQL (x2), Drop Foreign Key Constraint, Drop Column', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml', 'tm-1.4.0.feat-1513.06', '2.0.5', '3:8f9980911439ce0cbb91a1cf37288805', 163);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1513.07::mpagnon::(Checksum: 3:8effa97f3aa3afdfb1165e54f3590dbb)
-- Add attachment lists to reqLib
ALTER TABLE ATTACHMENT_LIST ADD RL_ID BIGINT;

ALTER TABLE ATTACHMENT_LIST ADD CONSTRAINT fk_rLib FOREIGN KEY (RL_ID) REFERENCES REQUIREMENT_LIBRARY (RL_ID);

insert into ATTACHMENT_LIST (RL_ID)
			select REQUIREMENT_LIBRARY.RL_ID from REQUIREMENT_LIBRARY;

update REQUIREMENT_LIBRARY 
			set ATTACHMENT_LIST_ID = (select ATTACHMENT_LIST.ATTACHMENT_LIST_ID from ATTACHMENT_LIST where ATTACHMENT_LIST.RL_ID = REQUIREMENT_LIBRARY.RL_ID)
			where ATTACHMENT_LIST_ID is null;

ALTER TABLE ATTACHMENT_LIST DROP CONSTRAINT fk_rLib;

ALTER TABLE ATTACHMENT_LIST DROP COLUMN RL_ID;

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('mpagnon', 'Add attachment lists to reqLib', NOW(), 'Add Column, Custom SQL (x2), Drop Foreign Key Constraint, Drop Column', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml', 'tm-1.4.0.feat-1513.07', '2.0.5', '3:8effa97f3aa3afdfb1165e54f3590dbb', 164);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1513.08::mpagnon::(Checksum: 3:a0a88d53a3a4159ea8924339b4ec7371)
-- Add attachment lists to test_case_library
ALTER TABLE ATTACHMENT_LIST ADD TCL_ID BIGINT;

ALTER TABLE ATTACHMENT_LIST ADD CONSTRAINT fk_tcLib FOREIGN KEY (TCL_ID) REFERENCES TEST_CASE_LIBRARY (TCL_ID);

insert into ATTACHMENT_LIST (TCL_ID)
			select TEST_CASE_LIBRARY.TCL_ID from TEST_CASE_LIBRARY;

update TEST_CASE_LIBRARY 
			set ATTACHMENT_LIST_ID = (select ATTACHMENT_LIST.ATTACHMENT_LIST_ID from ATTACHMENT_LIST where ATTACHMENT_LIST.TCL_ID = TEST_CASE_LIBRARY.TCL_ID)
			where ATTACHMENT_LIST_ID is null;

ALTER TABLE ATTACHMENT_LIST DROP CONSTRAINT fk_tcLib;

ALTER TABLE ATTACHMENT_LIST DROP COLUMN TCL_ID;

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('mpagnon', 'Add attachment lists to test_case_library', NOW(), 'Add Column, Custom SQL (x2), Drop Foreign Key Constraint, Drop Column', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml', 'tm-1.4.0.feat-1513.08', '2.0.5', '3:a0a88d53a3a4159ea8924339b4ec7371', 165);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1513.09::mpagnon::(Checksum: 3:eb49cfdde8f39905ce3134599987b174)
-- Add attachment lists to campaign libraries
ALTER TABLE ATTACHMENT_LIST ADD CL_ID BIGINT;

ALTER TABLE ATTACHMENT_LIST ADD CONSTRAINT fk_cLib FOREIGN KEY (CL_ID) REFERENCES CAMPAIGN_LIBRARY (CL_ID);

insert into ATTACHMENT_LIST (CL_ID)
			select CAMPAIGN_LIBRARY.CL_ID from CAMPAIGN_LIBRARY;

update CAMPAIGN_LIBRARY 
			set ATTACHMENT_LIST_ID = (select ATTACHMENT_LIST.ATTACHMENT_LIST_ID from ATTACHMENT_LIST where ATTACHMENT_LIST.CL_ID = CAMPAIGN_LIBRARY.CL_ID)
			where ATTACHMENT_LIST_ID is null;

ALTER TABLE ATTACHMENT_LIST DROP CONSTRAINT fk_cLib;

ALTER TABLE ATTACHMENT_LIST DROP COLUMN CL_ID;

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('mpagnon', 'Add attachment lists to campaign libraries', NOW(), 'Add Column, Custom SQL (x2), Drop Foreign Key Constraint, Drop Column', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml', 'tm-1.4.0.feat-1513.09', '2.0.5', '3:eb49cfdde8f39905ce3134599987b174', 166);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1513.010::mpagnon::(Checksum: 3:53271a83b14f6d877528c3f746ade8c8)
-- Make attachment_list_ids new fks not nullable
ALTER TABLE TEST_CASE_LIBRARY_NODE ALTER COLUMN  ATTACHMENT_LIST_ID BIGINT NOT NULL;

ALTER TABLE CAMPAIGN_LIBRARY_NODE ALTER COLUMN  ATTACHMENT_LIST_ID BIGINT NOT NULL;

ALTER TABLE RESOURCE ALTER COLUMN  ATTACHMENT_LIST_ID BIGINT NOT NULL;

ALTER TABLE PROJECT ALTER COLUMN  ATTACHMENT_LIST_ID BIGINT NOT NULL;

ALTER TABLE REQUIREMENT_LIBRARY ALTER COLUMN  ATTACHMENT_LIST_ID BIGINT NOT NULL;

ALTER TABLE CAMPAIGN_LIBRARY ALTER COLUMN  ATTACHMENT_LIST_ID BIGINT NOT NULL;

ALTER TABLE TEST_CASE_LIBRARY ALTER COLUMN  ATTACHMENT_LIST_ID BIGINT NOT NULL;

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('mpagnon', 'Make attachment_list_ids new fks not nullable', NOW(), 'Add Not-Null Constraint (x7)', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml', 'tm-1.4.0.feat-1513.010', '2.0.5', '3:53271a83b14f6d877528c3f746ade8c8', 167);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1513.11::mpagnon::(Checksum: 3:d9940e95526714a749acbc2df372c2cf)
-- Drop previous attachment list ids
ALTER TABLE TEST_CASE DROP CONSTRAINT fk_test_case_attachment_list;

ALTER TABLE CAMPAIGN DROP CONSTRAINT fk_campaign_attachment_list;

ALTER TABLE REQUIREMENT_VERSION DROP CONSTRAINT fk_requirement_version_attachment_list;

ALTER TABLE TEST_CASE DROP COLUMN ATTACHMENT_LIST_ID;

ALTER TABLE CAMPAIGN DROP COLUMN ATTACHMENT_LIST_ID;

ALTER TABLE REQUIREMENT_VERSION DROP COLUMN ATTACHMENT_LIST_ID;

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('mpagnon', 'Drop previous attachment list ids', NOW(), 'Drop Foreign Key Constraint (x3), Drop Column (x3)', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml', 'tm-1.4.0.feat-1513.11', '2.0.5', '3:d9940e95526714a749acbc2df372c2cf', 168);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1392.01::bsiri::(Checksum: 3:3ff2bd1da5ba3ca536fefc185d4f5c77)
-- The table CUSTOM_FIELD_VALUE holds instances of a CUSTOM_FIELD that are bound to instances of : 
-- 			test cases, requirement version, campagnes, iterations and test suites. A custom field value is created 
-- 			when a custom field binding is created or an entity subject to an existing custom field binding is created. 
-- 			A custom field value is destroyed when the bound entity instance is destroyed or the custom field binding 
-- 			is destroyed.			
-- 						
-- 			Note that in this table the coupling between the custom field value and the bound entity is week : it consists of a pair
-- 			of Type/ID (BINDABLE_ENTITY_TYPE and BINDABLE_ENTITY_ID) rather than a foreign key to the said entity, nor is true 
-- 			the opposite ( ie no FK from a test case to a custom field value).
CREATE TABLE CUSTOM_FIELD_VALUE (CFV_ID BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL, BOUND_ENTITY_ID BIGINT NOT NULL, BOUND_ENTITY_TYPE VARCHAR(30) NOT NULL, CFB_ID BIGINT NOT NULL, VALUE VARCHAR(255), CONSTRAINT pk_custom_field_value PRIMARY KEY (CFV_ID), CONSTRAINT fk_cfv_cf_binding FOREIGN KEY (CFB_ID) REFERENCES CUSTOM_FIELD_BINDING(CFB_ID));

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('bsiri', 'The table CUSTOM_FIELD_VALUE holds instances of a CUSTOM_FIELD that are bound to instances of : 
			test cases, requirement version, campagnes, iterations and test suites. A custom field value is created 
			when a custom field binding is created or an...', 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.4.0.xml', 'tm-1.4.0.feat-1392.01', '2.0.5', '3:3ff2bd1da5ba3ca536fefc185d4f5c77', 169);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1553.00::flaurens::(Checksum: 3:09e5775825b118f2e53c9ee6b264b530)
-- Adds a nature field to test cases
ALTER TABLE TEST_CASE ADD TC_NATURE VARCHAR(30) DEFAULT 'UNDEFINED' NOT NULL;

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('flaurens', 'Adds a nature field to test cases', 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.4.0.xml', 'tm-1.4.0.feat-1553.00', '2.0.5', '3:09e5775825b118f2e53c9ee6b264b530', 170);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1554.00::flaurens::(Checksum: 3:ff8827ecb0c7f0a6464bf71be87b1d2d)
-- Adds a type field to test cases
ALTER TABLE TEST_CASE ADD TC_TYPE VARCHAR(30) DEFAULT 'UNDEFINED' NOT NULL;

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('flaurens', 'Adds a type field to test cases', 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.4.0.xml', 'tm-1.4.0.feat-1554.00', '2.0.5', '3:ff8827ecb0c7f0a6464bf71be87b1d2d', 171);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1609.00::flaurens::(Checksum: 3:bc981c15be6c964ee3c651fe7a50fe66)
-- Adds a status field to test cases
ALTER TABLE TEST_CASE ADD TC_STATUS VARCHAR(30) DEFAULT 'WORK_IN_PROGRESS' NOT NULL;

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('flaurens', 'Adds a status field to test cases', 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.4.0.xml', 'tm-1.4.0.feat-1609.00', '2.0.5', '3:bc981c15be6c964ee3c651fe7a50fe66', 172);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1596.00::flaurens::(Checksum: 3:9265cec34c398e1e0e2e5db46f9e01bc)
-- Adds test case related fields to executions for denormalization
ALTER TABLE EXECUTION ADD TC_NATURE VARCHAR(30) DEFAULT 'UNDEFINED' NOT NULL;

ALTER TABLE EXECUTION ADD TC_TYPE VARCHAR(30) DEFAULT 'UNDEFINED' NOT NULL;

ALTER TABLE EXECUTION ADD TC_STATUS VARCHAR(30) DEFAULT 'WORK_IN_PROGRESS' NOT NULL;

ALTER TABLE EXECUTION ADD IMPORTANCE VARCHAR(20) DEFAULT 'LOW' NOT NULL;

ALTER TABLE EXECUTION ADD REFERENCE VARCHAR(20) DEFAULT null;

ALTER TABLE EXECUTION ADD TC_DESCRIPTION LONGVARCHAR DEFAULT null;

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('flaurens', 'Adds test case related fields to executions for denormalization', 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.4.0.xml', 'tm-1.4.0.feat-1596.00', '2.0.5', '3:9265cec34c398e1e0e2e5db46f9e01bc', 173);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1596.01::flaurens::(Checksum: 3:417f247ae9933e6f592c9d1caa4d4997)
-- adds test case information to executions created prior to the changeset tm-1.4.0.feat-1596.00
create table EXECUTION_TEST_CASE_DATA (TCLN_ID BIGINT, TC_DESCRIPTION TEXT, REFERENCE VARCHAR(20), IMPORTANCE VARCHAR(20), TC_NATURE VARCHAR(30), TC_TYPE VARCHAR(30), TC_STATUS VARCHAR(30));

insert into EXECUTION_TEST_CASE_DATA (TCLN_ID, TC_DESCRIPTION, REFERENCE, IMPORTANCE, TC_NATURE, TC_TYPE, TC_STATUS)
				select
					tc.tcln_id AS TCLN_ID,
					tcln.description AS DESCRIPTION,
					tc.reference AS REFERENCE,
					tc.importance AS IMPORTANCE,
					tc.tc_nature AS TCNATURE,
					tc.tc_type AS TCTYPE,
					tc.tc_status AS TCSTATUS
				from TEST_CASE tc
				join TEST_CASE_LIBRARY_NODE tcln on tcln.tcln_id = tc.tcln_id;

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('flaurens', 'adds test case information to executions created prior to the changeset tm-1.4.0.feat-1596.00', 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.4.0.xml', 'tm-1.4.0.feat-1596.01', '2.0.5', '3:417f247ae9933e6f592c9d1caa4d4997', 174);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1596.01-a::mpagnon::(Checksum: 3:52c10d25222de47923adddd800a091c9)
update EXECUTION exe
			set
			tc_description = (select TC_DESCRIPTION from EXECUTION_TEST_CASE_DATA etcd where
			etcd.TCLN_ID = exe.TCLN_ID),
			reference = (select REFERENCE from EXECUTION_TEST_CASE_DATA etcd where
			etcd.TCLN_ID = exe.TCLN_ID),
			importance = (select IMPORTANCE from EXECUTION_TEST_CASE_DATA etcd where
			etcd.TCLN_ID = exe.TCLN_ID),
			tc_nature = (select TC_NATURE from EXECUTION_TEST_CASE_DATA etcd where
			etcd.TCLN_ID = exe.TCLN_ID),
			tc_type = (select TC_TYPE from EXECUTION_TEST_CASE_DATA etcd where
			etcd.TCLN_ID = exe.TCLN_ID),
			tc_status = (select TC_STATUS from EXECUTION_TEST_CASE_DATA etcd where
			etcd.TCLN_ID = exe.TCLN_ID);

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.4.0.xml', 'tm-1.4.0.feat-1596.01-a', '2.0.5', '3:52c10d25222de47923adddd800a091c9', 175);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1596.01-b::mpagnon::(Checksum: 3:ed14382f2e7eb8cb7b61be96640dbe8b)
-- this grammar is not supported by h2 and is more efficient
-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1110.01::gfouquet::(Checksum: 3:cb29a4e0fdfd7678777182ec9d4378f2)
-- Adds a type discriminator column on PROJECT
ALTER TABLE PROJECT ADD PROJECT_TYPE CHAR(1) DEFAULT 'P' NOT NULL;

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('gfouquet', 'Adds a type discriminator column on PROJECT', 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.4.0.xml', 'tm-1.4.0.feat-1110.01', '2.0.5', '3:cb29a4e0fdfd7678777182ec9d4378f2', 176);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1393.01::mpagnon::(Checksum: 3:c8dd98f3b1a0724f1d6620ae4dbef481)
-- Adds a className for the ProjectTemplate, this is needed so that a project template can hold user's permissions
INSERT INTO ACL_CLASS (CLASSNAME) VALUES ('org.squashtest.csp.tm.domain.project.ProjectTemplate');

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('mpagnon', 'Adds a className for the ProjectTemplate, this is needed so that a project template can hold user''s permissions', NOW(), 'Insert Row', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml', 'tm-1.4.0.feat-1393.01', '2.0.5', '3:c8dd98f3b1a0724f1d6620ae4dbef481', 177);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1628.01::flaurens::(Checksum: 3:3fa7ef454684cf4578514710e007516a)
ALTER TABLE REQUIREMENT_VERSION ALTER COLUMN  REFERENCE SET DEFAULT '';

ALTER TABLE TEST_CASE ALTER COLUMN  REFERENCE SET DEFAULT '';

ALTER TABLE EXECUTION ALTER COLUMN  REFERENCE SET DEFAULT '';

ALTER TABLE REQUIREMENT_VERSION ALTER COLUMN REFERENCE VARCHAR(50);

ALTER TABLE TEST_CASE ALTER COLUMN REFERENCE VARCHAR(50);

ALTER TABLE EXECUTION ALTER COLUMN REFERENCE VARCHAR(50);

ALTER TABLE REQUIREMENT_VERSION ALTER COLUMN  REFERENCE SET DEFAULT '';

ALTER TABLE TEST_CASE ALTER COLUMN  REFERENCE SET DEFAULT '';

ALTER TABLE EXECUTION ALTER COLUMN  REFERENCE SET DEFAULT '';

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('flaurens', '', NOW(), 'Add Default Value (x3), Modify data type (x3), Add Default Value (x3)', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml', 'tm-1.4.0.feat-1628.01', '2.0.5', '3:3fa7ef454684cf4578514710e007516a', 178);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1638.01::mpagnon::(Checksum: 3:7fedce0143f1676056ea73d819d85dd5)
ALTER TABLE CUSTOM_FIELD ADD CODE VARCHAR(30) DEFAULT '' NOT NULL;

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('mpagnon', '', 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.4.0.xml', 'tm-1.4.0.feat-1638.01', '2.0.5', '3:7fedce0143f1676056ea73d819d85dd5', 179);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.4.0.xml::tm-1.4.0.feat-1638.02::mpagnon::(Checksum: 3:6083a7212cc3145d022f30bf00f6e614)
ALTER TABLE CUSTOM_FIELD_OPTION ADD CODE VARCHAR(30) DEFAULT '' NOT NULL;

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('mpagnon', '', 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.4.0.xml', 'tm-1.4.0.feat-1638.02', '2.0.5', '3:6083a7212cc3145d022f30bf00f6e614', 180);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/core/core.changelog-1.4.0.xml::core-feat-327::mpagnon::(Checksum: 3:34782a78840d9958a93867752ac303e8)
-- Because admin was not active , need to make sure that all user active in auth_user are active in core_user
update CORE_USER
					set ACTIVE = true
					where CORE_USER.LOGIN in (select AUTH_USER.LOGIN from AUTH_USER where AUTH_USER.ACTIVE = true);

INSERT INTO DATABASECHANGELOG (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('mpagnon', 'Because admin was not active , need to make sure that all user active in auth_user are active in core_user', NOW(), 'Custom SQL', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/core/core.changelog-1.4.0.xml', 'core-feat-327', '2.0.5', '3:34782a78840d9958a93867752ac303e8', 181);

-- Release Database Lock
-- Release Database Lock
