-- *********************************************************************
-- 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.12.0.xml
-- Ran at: 03/04/20 12:06
-- Against: liquibase@jdbc:postgresql://localhost:5432/squash_dist_cur
-- 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.12.0.xml::tm-1.12.0::jsimon::(Checksum: 3:73810dd59459401f6b26a4269d32fb6e)
-- Update TM database version number
UPDATE CORE_CONFIG SET VALUE = '1.12.0' WHERE STR_KEY = 'squashtest.tm.database.version';

INSERT INTO databasechangelog (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('jsimon', '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.12.0.xml', 'tm-1.12.0', '2.0.5', '3:73810dd59459401f6b26a4269d32fb6e', 339);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml::tm-1.12.0.feature-3607-1::jsimon::(Checksum: 3:35fcb826269f492dfe47bb51c3a5c5fb)
-- Table for Milestones
CREATE TABLE MILESTONE (MILESTONE_ID bigserial NOT NULL, LABEL VARCHAR(30) NOT NULL, STATUS VARCHAR(30), END_DATE TIMESTAMP WITH TIME ZONE NOT NULL, DESCRIPTION TEXT, M_RANGE VARCHAR(30) NOT NULL, CREATED_BY VARCHAR(50) NOT NULL, CREATED_ON TIMESTAMP WITH TIME ZONE NOT NULL, LAST_MODIFIED_BY VARCHAR(50) DEFAULT null, LAST_MODIFIED_ON TIMESTAMP WITH TIME ZONE DEFAULT null, USER_ID BIGINT NOT NULL, CONSTRAINT PK_MILESTONE PRIMARY KEY (MILESTONE_ID), CONSTRAINT fk_milestone_owner FOREIGN KEY (USER_ID) REFERENCES CORE_USER(PARTY_ID), UNIQUE (LABEL));

COMMENT ON COLUMN MILESTONE.MILESTONE_ID IS 'Primary key';

COMMENT ON COLUMN MILESTONE.LABEL IS 'Milestone label';

COMMENT ON COLUMN MILESTONE.STATUS IS 'Milestone status';

COMMENT ON COLUMN MILESTONE.END_DATE IS 'Term date';

COMMENT ON COLUMN MILESTONE.DESCRIPTION IS 'Milestone description';

COMMENT ON COLUMN MILESTONE.M_RANGE IS 'Milestone range';

COMMENT ON COLUMN MILESTONE.CREATED_BY IS 'Name of the milestone creator';

COMMENT ON COLUMN MILESTONE.CREATED_ON IS 'Date of creation.';

COMMENT ON COLUMN MILESTONE.LAST_MODIFIED_BY IS 'last modified by';

COMMENT ON COLUMN MILESTONE.LAST_MODIFIED_ON IS 'Date of last update';

COMMENT ON COLUMN MILESTONE.USER_ID IS 'the user that own the milestone';

CREATE INDEX idx_milestone ON MILESTONE(MILESTONE_ID);

INSERT INTO databasechangelog (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('jsimon', 'Table for Milestones', 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.12.0.xml', 'tm-1.12.0.feature-3607-1', '2.0.5', '3:35fcb826269f492dfe47bb51c3a5c5fb', 340);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml::tm-1.12.0.feature-3608-1::jsimon::(Checksum: 3:0477d7c91c2d526abf01c921e3eb28a6)
-- Table for MilestoneBinding
CREATE TABLE MILESTONE_BINDING (MILESTONE_BINDING_ID bigserial NOT NULL, MILESTONE_ID BIGINT NOT NULL, PROJECT_ID BIGINT NOT NULL, CONSTRAINT PK_MILESTONE_BINDING PRIMARY KEY (MILESTONE_BINDING_ID), CONSTRAINT FK_MILESTONE_BINDING_MILESTONE FOREIGN KEY (MILESTONE_ID) REFERENCES MILESTONE(MILESTONE_ID), CONSTRAINT FK_MILESTONE_BINDING_PROJECT FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID));

INSERT INTO databasechangelog (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('jsimon', 'Table for MilestoneBinding', 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.12.0.xml', 'tm-1.12.0.feature-3608-1', '2.0.5', '3:0477d7c91c2d526abf01c921e3eb28a6', 341);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml::tm-1.12.0.feature-3609-1::jsimon::(Checksum: 3:c7ead5ace5583a01da639c5bd1de18d0)
-- Table for MilestoneBindingPerimeter
CREATE TABLE MILESTONE_BINDING_PERIMETER (MILESTONE_BINDING_PERIMETER_ID bigserial NOT NULL, MILESTONE_ID BIGINT NOT NULL, PROJECT_ID BIGINT NOT NULL, CONSTRAINT PK_MILESTONE_BINDING_PERIMETER PRIMARY KEY (MILESTONE_BINDING_PERIMETER_ID), CONSTRAINT FK_MILESTONE_BINDING_PERIMETER_PROJECT FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT(PROJECT_ID), CONSTRAINT FK_MILESTONE_BINDING_PERIMETER_MILESTONE FOREIGN KEY (MILESTONE_ID) REFERENCES MILESTONE(MILESTONE_ID));

INSERT INTO databasechangelog (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('jsimon', 'Table for MilestoneBindingPerimeter', 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.12.0.xml', 'tm-1.12.0.feature-3609-1', '2.0.5', '3:c7ead5ace5583a01da639c5bd1de18d0', 342);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml::tm-1.12.0.feature-3823-1::bsiri::(Checksum: 3:d0b201e944377deddef2a49348f8650f)
-- Creating the values table for multi-valued custom fields, much like CUSTOM_FIELD_OPTION is. 
--   	Note : the DELETE CASCADE on the foreign key is necessary because Hibernate won't do it (as specified, see HHH-5529)
CREATE TABLE CUSTOM_FIELD_VALUE_OPTION (CFV_ID BIGINT NOT NULL, LABEL VARCHAR(255) NOT NULL, POSITION INT NOT NULL, CONSTRAINT fk_cfv_option_cfv FOREIGN KEY (CFV_ID) REFERENCES CUSTOM_FIELD_VALUE(CFV_ID) ON DELETE CASCADE);

COMMENT ON TABLE CUSTOM_FIELD_VALUE_OPTION IS 'The table.';

INSERT INTO databasechangelog (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('bsiri', 'Creating the values table for multi-valued custom fields, much like CUSTOM_FIELD_OPTION is. 
  	Note : the DELETE CASCADE on the foreign key is necessary because Hibernate won''t do it (as specified, see HHH-5529)', 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.12.0.xml', 'tm-1.12.0.feature-3823-1', '2.0.5', '3:d0b201e944377deddef2a49348f8650f', 343);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml::tm-1.12.0.feature-3823-2::bsiri::(Checksum: 3:10e995d6ae6e884de3a56ea3089b9b6b)
-- Same table for the denormalized field values
CREATE TABLE DENORMALIZED_FIELD_VALUE_OPTION (DFV_ID BIGINT NOT NULL, LABEL VARCHAR(255) NOT NULL, POSITION INT NOT NULL, CONSTRAINT fk_dfv_option_dfv FOREIGN KEY (DFV_ID) REFERENCES DENORMALIZED_FIELD_VALUE(DFV_ID) ON DELETE CASCADE);

INSERT INTO databasechangelog (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('bsiri', 'Same table for the denormalized field values', 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.12.0.xml', 'tm-1.12.0.feature-3823-2', '2.0.5', '3:10e995d6ae6e884de3a56ea3089b9b6b', 344);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml::tm-1.12.0.feature-3823-3::bsiri::(Checksum: 3:40b71e496b617a6e1643aea07b03b466)
-- tables CUSTOM_FIELD_OPTION and DENORMALIZED_FIELD_OPTION no longer enforce the option position.
ALTER TABLE CUSTOM_FIELD_OPTION ALTER COLUMN  POSITION DROP NOT NULL;

ALTER TABLE DENORMALIZED_FIELD_OPTION ALTER COLUMN  POSITION DROP NOT NULL;

INSERT INTO databasechangelog (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('bsiri', 'tables CUSTOM_FIELD_OPTION and DENORMALIZED_FIELD_OPTION no longer enforce the option position.', NOW(), 'Drop Not-Null Constraint (x2)', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml', 'tm-1.12.0.feature-3823-3', '2.0.5', '3:40b71e496b617a6e1643aea07b03b466', 345);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml::tm-1.12.0.issue-4017-1::bsiri::(Checksum: 3:5682a9420e1160eef49f4838d79d4de8)
-- Some columns in REQUIREMENT_PROPERTY_CHANGE are too short compared to what 
--   	they are supposed to store. This changeset makes them bigger.
ALTER TABLE REQUIREMENT_PROPERTY_CHANGE ALTER COLUMN OLD_VALUE TYPE VARCHAR(255);

ALTER TABLE REQUIREMENT_PROPERTY_CHANGE ALTER COLUMN NEW_VALUE TYPE VARCHAR(255);

INSERT INTO databasechangelog (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('bsiri', 'Some columns in REQUIREMENT_PROPERTY_CHANGE are too short compared to what 
  	they are supposed to store. This changeset makes them bigger.', NOW(), 'Modify data type (x2)', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml', 'tm-1.12.0.issue-4017-1', '2.0.5', '3:5682a9420e1160eef49f4838d79d4de8', 346);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml::tm-1.12.0.feat-4068-1::bsiri::(Checksum: 3:84795c97ecd084f4710471c4613447f8)
-- creating the table structure for parameterized list
CREATE TABLE INFO_LIST (INFO_LIST_ID bigserial NOT NULL, LABEL VARCHAR(100), DESCRIPTION TEXT, CODE VARCHAR(30) NOT NULL, CREATED_BY VARCHAR(50) NOT NULL, CREATED_ON TIMESTAMP WITH TIME ZONE NOT NULL, LAST_MODIFIED_BY VARCHAR(50) DEFAULT null, LAST_MODIFIED_ON TIMESTAMP WITH TIME ZONE DEFAULT null, CONSTRAINT PK_INFO_LIST PRIMARY KEY (INFO_LIST_ID), UNIQUE (LABEL), UNIQUE (CODE));

COMMENT ON COLUMN INFO_LIST.INFO_LIST_ID IS 'the ID';

COMMENT ON COLUMN INFO_LIST.LABEL IS 'the label for this list. Would noly be displayed in the administration page as the name  actually displayed to regular uses would depend on the role of that list on a given projet (criticality, nature etc)';

COMMENT ON COLUMN INFO_LIST.DESCRIPTION IS 'a description for that list';

COMMENT ON COLUMN INFO_LIST.CODE IS 'a code that helps identifying that list';

COMMENT ON COLUMN INFO_LIST.CREATED_BY IS 'username of the user who created that list';

COMMENT ON COLUMN INFO_LIST.CREATED_ON IS 'the time at when that list was created';

COMMENT ON COLUMN INFO_LIST.LAST_MODIFIED_BY IS 'username of the last user who modified one of the list attributes';

COMMENT ON COLUMN INFO_LIST.LAST_MODIFIED_ON IS 'Time when the list was touched last';

CREATE INDEX idx_info_list_code ON INFO_LIST(CODE);

CREATE TABLE INFO_LIST_ITEM (ITEM_ID bigserial NOT NULL, ITEM_TYPE VARCHAR(3) NOT NULL, LIST_ID BIGINT, ITEM_INDEX INT, LABEL VARCHAR(100) NOT NULL, CODE VARCHAR(30) NOT NULL, IS_DEFAULT BOOLEAN DEFAULT FALSE NOT NULL, ICON_NAME VARCHAR(100), CONSTRAINT PK_INFO_LIST_ITEM PRIMARY KEY (ITEM_ID), CONSTRAINT fk_info_item_list FOREIGN KEY (LIST_ID) REFERENCES INFO_LIST(INFO_LIST_ID), UNIQUE (CODE));

COMMENT ON COLUMN INFO_LIST_ITEM.ITEM_ID IS 'an ID, what did you expect ?';

COMMENT ON COLUMN INFO_LIST_ITEM.ITEM_TYPE IS 'discriminator telling whether this item is user-made or builtin in the app. Pick one of ''USR'' or ''SYS''';

COMMENT ON COLUMN INFO_LIST_ITEM.LIST_ID IS 'foreign key to the list this item belongs to. Allows ''NULL'' for Hibernate to work.';

COMMENT ON COLUMN INFO_LIST_ITEM.ITEM_INDEX IS 'the position of that item in the list. Allows ''NULL'' for Hibernate to work.';

COMMENT ON COLUMN INFO_LIST_ITEM.LABEL IS 'a label to be displayed. If the item is builtin this label will be a i18n key, else the label will be displayed verbatim';

COMMENT ON COLUMN INFO_LIST_ITEM.CODE IS 'a code that helps identifying that item';

COMMENT ON COLUMN INFO_LIST_ITEM.IS_DEFAULT IS 'whether this item is the default item for         its list. Only one item per list should have it true';

COMMENT ON COLUMN INFO_LIST_ITEM.ICON_NAME IS 'the identifier of the icon to be displayed';

CREATE INDEX idx_info_list_item_code ON INFO_LIST_ITEM(CODE);

CREATE INDEX idx_info_list_label ON INFO_LIST(LABEL);

INSERT INTO databasechangelog (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('bsiri', 'creating the table structure for parameterized list', NOW(), 'Create Table, Create Index, 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.12.0.xml', 'tm-1.12.0.feat-4068-1', '2.0.5', '3:84795c97ecd084f4710471c4613447f8', 347);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml::tm-1.12.0.feat-4068-2::bsiri::(Checksum: 3:a99934b9aa55714bcb7411ad75692d15)
-- Updating the definition of an execution
ALTER TABLE EXECUTION ADD TC_NAT_LABEL VARCHAR(100);

ALTER TABLE EXECUTION ADD TC_NAT_CODE VARCHAR(30);

ALTER TABLE EXECUTION ADD TC_NAT_ICON_NAME VARCHAR(100);

ALTER TABLE EXECUTION ADD TC_TYP_LABEL VARCHAR(100);

ALTER TABLE EXECUTION ADD TC_TYP_CODE VARCHAR(30);

ALTER TABLE EXECUTION ADD TC_TYP_ICON_NAME VARCHAR(100);

COMMENT ON COLUMN EXECUTION.TC_NAT_LABEL IS 'a label to be displayed. If the item is builtin this label will be a i18n key, else the label will        be displayed verbatim';

COMMENT ON COLUMN EXECUTION.TC_NAT_CODE IS 'a code that helps identifying that item. Note that unlike the original version the values for       that column will not be unique.';

COMMENT ON COLUMN EXECUTION.TC_NAT_ICON_NAME IS 'the identifier of the icon to be displayed';

COMMENT ON COLUMN EXECUTION.TC_TYP_LABEL IS 'a label to be displayed. If the item is builtin this label will be a i18n key, else the label will  be displayed verbatim';

COMMENT ON COLUMN EXECUTION.TC_TYP_CODE IS 'a code that helps identifying that item. Note that unlike the original version the values for       that column will not be unique.';

COMMENT ON COLUMN EXECUTION.TC_TYP_ICON_NAME IS 'the identifier of the icon to be displayed';

INSERT INTO databasechangelog (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('bsiri', 'Updating the definition of an execution', 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.12.0.xml', 'tm-1.12.0.feat-4068-2', '2.0.5', '3:a99934b9aa55714bcb7411ad75692d15', 348);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml::tm-1.12.0.feat-4068-3::bsiri::(Checksum: 3:ff8906f1d84a632e135428a73ad6e8b9)
-- inserting the default lists in the database
INSERT INTO INFO_LIST (CODE, CREATED_BY, CREATED_ON, DESCRIPTION, INFO_LIST_ID, LABEL, LAST_MODIFIED_BY, LAST_MODIFIED_ON) VALUES ('DEF_REQ_CAT', 'system', '2010-01-01 00:00:00', '', '1', 'infolist.category.default', 'system', '2010-01-01 00:00:00');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('CAT_FUNCTIONAL', 'def_cat_functional', FALSE, '1', '0', 'SYS', 'requirement.category.CAT_FUNCTIONAL', '1');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('CAT_NON_FUNCTIONAL', 'def_cat_non-functional', FALSE, '2', '1', 'SYS', 'requirement.category.CAT_NON_FUNCTIONAL', '1');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('CAT_USE_CASE', 'def_cat_use-case', FALSE, '3', '2', 'SYS', 'requirement.category.CAT_USE_CASE', '1');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('CAT_BUSINESS', 'def_cat_business', FALSE, '4', '3', 'SYS', 'requirement.category.CAT_BUSINESS', '1');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('CAT_TEST_REQUIREMENT', 'def_cat_test-requirement', FALSE, '5', '4', 'SYS', 'requirement.category.CAT_TEST_REQUIREMENT', '1');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('CAT_UNDEFINED', 'def_cat_undefined', TRUE, '6', '5', 'SYS', 'requirement.category.CAT_UNDEFINED', '1');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('CAT_ERGONOMIC', 'def_cat_ergonomic', FALSE, '7', '6', 'SYS', 'requirement.category.CAT_ERGONOMIC', '1');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('CAT_PERFORMANCE', 'def_cat_performance', FALSE, '8', '7', 'SYS', 'requirement.category.CAT_PERFORMANCE', '1');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('CAT_TECHNICAL', 'def_cat_technical', FALSE, '9', '8', 'SYS', 'requirement.category.CAT_TECHNICAL', '1');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('CAT_USER_STORY', 'def_cat_user-story', FALSE, '10', '9', 'SYS', 'requirement.category.CAT_USER_STORY', '1');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('CAT_SECURITY', 'def_cat_security', FALSE, '11', '10', 'SYS', 'requirement.category.CAT_SECURITY', '1');

INSERT INTO INFO_LIST (CODE, CREATED_BY, CREATED_ON, DESCRIPTION, INFO_LIST_ID, LABEL, LAST_MODIFIED_BY, LAST_MODIFIED_ON) VALUES ('DEF_TC_NAT', 'system', '2010-01-01 00:00:00', '', '2', 'infolist.nature.default', 'system', '2010-01-01 00:00:00');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('NAT_UNDEFINED', 'noicon', TRUE, '12', '0', 'SYS', 'test-case.nature.NAT_UNDEFINED', '2');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('NAT_FUNCTIONAL_TESTING', 'noicon', FALSE, '13', '1', 'SYS', 'test-case.nature.NAT_FUNCTIONAL_TESTING', '2');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('NAT_BUSINESS_TESTING', 'noicon', FALSE, '14', '2', 'SYS', 'test-case.nature.NAT_BUSINESS_TESTING', '2');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('NAT_USER_TESTING', 'noicon', FALSE, '15', '3', 'SYS', 'test-case.nature.NAT_USER_TESTING', '2');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('NAT_NON_FUNCTIONAL_TESTING', 'noicon', FALSE, '16', '4', 'SYS', 'test-case.nature.NAT_NON_FUNCTIONAL_TESTING', '2');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('NAT_PERFORMANCE_TESTING', 'noicon', FALSE, '17', '5', 'SYS', 'test-case.nature.NAT_PERFORMANCE_TESTING', '2');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('NAT_SECURITY_TESTING', 'noicon', FALSE, '18', '6', 'SYS', 'test-case.nature.NAT_SECURITY_TESTING', '2');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('NAT_ATDD', 'noicon', FALSE, '19', '7', 'SYS', 'test-case.nature.NAT_ATDD', '2');

INSERT INTO INFO_LIST (CODE, CREATED_BY, CREATED_ON, DESCRIPTION, INFO_LIST_ID, LABEL, LAST_MODIFIED_BY, LAST_MODIFIED_ON) VALUES ('DEF_TC_TYP', 'system', '2010-01-01 00:00:00', '', '3', 'infolist.type.default', 'system', '2010-01-01 00:00:00');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('TYP_UNDEFINED', 'noicon', TRUE, '20', '0', 'SYS', 'test-case.type.TYP_UNDEFINED', '3');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('TYP_COMPLIANCE_TESTING', 'noicon', FALSE, '21', '1', 'SYS', 'test-case.type.TYP_COMPLIANCE_TESTING', '3');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('TYP_CORRECTION_TESTING', 'noicon', FALSE, '22', '2', 'SYS', 'test-case.type.TYP_CORRECTION_TESTING', '3');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('TYP_EVOLUTION_TESTING', 'noicon', FALSE, '23', '3', 'SYS', 'test-case.type.TYP_EVOLUTION_TESTING', '3');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('TYP_REGRESSION_TESTING', 'noicon', FALSE, '24', '4', 'SYS', 'test-case.type.TYP_REGRESSION_TESTING', '3');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('TYP_END_TO_END_TESTING', 'noicon', FALSE, '25', '5', 'SYS', 'test-case.type.TYP_END_TO_END_TESTING', '3');

INSERT INTO INFO_LIST_ITEM (CODE, ICON_NAME, IS_DEFAULT, ITEM_ID, ITEM_INDEX, ITEM_TYPE, LABEL, LIST_ID) VALUES ('TYP_PARTNER_TESTING', 'noicon', FALSE, '26', '6', 'SYS', 'test-case.type.TYP_PARTNER_TESTING', '3');

INSERT INTO databasechangelog (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('bsiri', 'inserting the default lists in the database', NOW(), 'Insert Row (x29)', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml', 'tm-1.12.0.feat-4068-3', '2.0.5', '3:ff8906f1d84a632e135428a73ad6e8b9', 349);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml::tm-1.12.0.feat-4068-4::bsiri::(Checksum: 3:7f89020c83570898822dc301bf8c6cfa)
-- other structural modifications
ALTER TABLE PROJECT ADD REQ_CATEGORIES_LIST BIGINT NOT NULL DEFAULT '1';

ALTER TABLE PROJECT ADD CONSTRAINT proj_req_categories FOREIGN KEY (REQ_CATEGORIES_LIST) REFERENCES INFO_LIST (INFO_LIST_ID);

ALTER TABLE PROJECT ADD TC_NATURES_LIST BIGINT NOT NULL DEFAULT '2';

ALTER TABLE PROJECT ADD CONSTRAINT proj_tc_natures FOREIGN KEY (TC_NATURES_LIST) REFERENCES INFO_LIST (INFO_LIST_ID);

ALTER TABLE PROJECT ADD TC_TYPES_LIST BIGINT NOT NULL DEFAULT '3';

ALTER TABLE PROJECT ADD CONSTRAINT proj_tc_types FOREIGN KEY (TC_TYPES_LIST) REFERENCES INFO_LIST (INFO_LIST_ID);

COMMENT ON COLUMN PROJECT.REQ_CATEGORIES_LIST IS 'foreign key to the requirement categories used in that project';

COMMENT ON COLUMN PROJECT.TC_NATURES_LIST IS 'foreign key to the test case natures used in that project';

COMMENT ON COLUMN PROJECT.TC_TYPES_LIST IS 'foreign key to the test case types used in that project';

INSERT INTO databasechangelog (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('bsiri', 'other structural modifications', 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.12.0.xml', 'tm-1.12.0.feat-4068-4', '2.0.5', '3:7f89020c83570898822dc301bf8c6cfa', 350);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml::tm-1.12.0.feat-4068-6::bsiri::(Checksum: 3:00562703c1781e21e3f8410c1f5b5653)
-- migrate the test cases
ALTER TABLE TEST_CASE RENAME COLUMN TC_NATURE TO TC_NATURE_OLD;

ALTER TABLE TEST_CASE ADD TC_NATURE BIGINT NOT NULL DEFAULT '12';

ALTER TABLE TEST_CASE ADD CONSTRAINT fk_tc_nature FOREIGN KEY (TC_NATURE) REFERENCES INFO_LIST_ITEM (ITEM_ID);

COMMENT ON COLUMN TEST_CASE.TC_NATURE IS 'foreign key to the info list item';

update TEST_CASE set TC_NATURE = 12 where TC_NATURE_OLD = 'UNDEFINED';

update TEST_CASE set TC_NATURE = 13 where TC_NATURE_OLD = 'FUNCTIONAL_TESTING';

update TEST_CASE set TC_NATURE = 14 where TC_NATURE_OLD = 'BUSINESS_TESTING';

update TEST_CASE set TC_NATURE = 15 where TC_NATURE_OLD = 'USER_TESTING';

update TEST_CASE set TC_NATURE = 16 where TC_NATURE_OLD = 'NON_FUNCTIONAL_TESTING';

update TEST_CASE set TC_NATURE = 17 where TC_NATURE_OLD = 'PERFORMANCE_TESTING';

update TEST_CASE set TC_NATURE = 18 where TC_NATURE_OLD = 'SECURITY_TESTING';

update TEST_CASE set TC_NATURE = 19 where TC_NATURE_OLD = 'ATDD';

ALTER TABLE TEST_CASE DROP COLUMN TC_NATURE_OLD;

ALTER TABLE TEST_CASE RENAME COLUMN TC_TYPE TO TC_TYPE_OLD;

ALTER TABLE TEST_CASE ADD TC_TYPE BIGINT NOT NULL DEFAULT '20';

ALTER TABLE TEST_CASE ADD CONSTRAINT fk_tc_type FOREIGN KEY (TC_TYPE) REFERENCES INFO_LIST_ITEM (ITEM_ID);

COMMENT ON COLUMN TEST_CASE.TC_TYPE IS 'foreign key to the info list item';

update TEST_CASE set TC_TYPE = 20 where TC_TYPE_OLD = 'UNDEFINED';

update TEST_CASE set TC_TYPE = 21 where TC_TYPE_OLD = 'COMPLIANCE_TESTING';

update TEST_CASE set TC_TYPE = 22 where TC_TYPE_OLD = 'CORRECTION_TESTING';

update TEST_CASE set TC_TYPE = 23 where TC_TYPE_OLD = 'EVOLUTION_TESTING';

update TEST_CASE set TC_TYPE = 24 where TC_TYPE_OLD = 'REGRESSION_TESTING';

update TEST_CASE set TC_TYPE = 25 where TC_TYPE_OLD = 'END_TO_END_TESTING';

update TEST_CASE set TC_TYPE = 26 where TC_TYPE_OLD = 'PARTNER_TESTING';

ALTER TABLE TEST_CASE DROP COLUMN TC_TYPE_OLD;

INSERT INTO databasechangelog (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('bsiri', 'migrate the test cases', NOW(), 'Rename Column, Add Column, Custom SQL, Drop Column, Rename Column, Add Column, Custom SQL, Drop Column', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml', 'tm-1.12.0.feat-4068-6', '2.0.5', '3:00562703c1781e21e3f8410c1f5b5653', 351);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml::tm-1.12.0.feat-4068-7::bsiri::(Checksum: 3:a7e3bf19f2a9795bd34d208f8a3b5c0e)
-- migrate the requirements
ALTER TABLE REQUIREMENT_VERSION RENAME COLUMN CATEGORY TO CATEGORY_OLD;

ALTER TABLE REQUIREMENT_VERSION ADD CATEGORY BIGINT NOT NULL DEFAULT '1';

ALTER TABLE REQUIREMENT_VERSION ADD CONSTRAINT fk_req_nature FOREIGN KEY (CATEGORY) REFERENCES INFO_LIST_ITEM (ITEM_ID);

COMMENT ON COLUMN REQUIREMENT_VERSION.CATEGORY IS 'foreign key to the info list item';

update REQUIREMENT_VERSION set CATEGORY = 1 where CATEGORY_OLD = 'FUNCTIONAL';

update REQUIREMENT_VERSION set CATEGORY = 2 where CATEGORY_OLD = 'NON_FUNCTIONAL';

update REQUIREMENT_VERSION set CATEGORY = 3 where CATEGORY_OLD = 'USE_CASE';

update REQUIREMENT_VERSION set CATEGORY = 4 where CATEGORY_OLD = 'BUSINESS';

update REQUIREMENT_VERSION set CATEGORY = 5 where CATEGORY_OLD = 'TEST_REQUIREMENT';

update REQUIREMENT_VERSION set CATEGORY = 6 where CATEGORY_OLD = 'UNDEFINED';

update REQUIREMENT_VERSION set CATEGORY = 7 where CATEGORY_OLD = 'ERGONOMIC';

update REQUIREMENT_VERSION set CATEGORY = 8 where CATEGORY_OLD = 'PERFORMANCE';

update REQUIREMENT_VERSION set CATEGORY = 9 where CATEGORY_OLD = 'TECHNICAL';

update REQUIREMENT_VERSION set CATEGORY = 10 where CATEGORY_OLD = 'USER_STORY';

update REQUIREMENT_VERSION set CATEGORY = 11 where CATEGORY_OLD = 'SECURITY';

ALTER TABLE REQUIREMENT_VERSION DROP COLUMN CATEGORY_OLD;

INSERT INTO databasechangelog (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('bsiri', 'migrate the requirements', NOW(), 'Rename Column, Add Column, Custom SQL, Drop Column', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml', 'tm-1.12.0.feat-4068-7', '2.0.5', '3:a7e3bf19f2a9795bd34d208f8a3b5c0e', 352);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml::tm-1.12.0.feat-4068-8::bsiri::(Checksum: 3:b8affe1b87f9e96de5b10ccde72af5eb)
-- migrating the columns from EXECUTION
update EXECUTION
      set TC_NAT_LABEL = 'test-case.nature.NAT_UNDEFINED',
      TC_NAT_CODE = 'NAT_UNDEFINED',
      TC_NAT_ICON_NAME = 'noicon'
      where TC_NATURE='UNDEFINED';

update EXECUTION
      set TC_NAT_LABEL = 'test-case.nature.NAT_FUNCTIONAL_TESTING',
      TC_NAT_CODE = 'NAT_FUNCTIONAL_TESTING',
      TC_NAT_ICON_NAME = 'noicon'
      where TC_NATURE='FUNCTIONAL_TESTING';

update EXECUTION
      set TC_NAT_LABEL = 'test-case.nature.NAT_BUSINESS_TESTING',
      TC_NAT_CODE = 'NAT_BUSINESS_TESTING',
      TC_NAT_ICON_NAME = 'noicon'
      where TC_NATURE='BUSINESS_TESTING';

update EXECUTION
      set TC_NAT_LABEL = 'test-case.nature.NAT_USER_TESTING',
      TC_NAT_CODE = 'NAT_USER_TESTING',
      TC_NAT_ICON_NAME = 'noicon'
      where TC_NATURE='USER_TESTING';

update EXECUTION
      set TC_NAT_LABEL = 'test-case.nature.NAT_NON_FUNCTIONAL_TESTING',
      TC_NAT_CODE = 'NAT_NON_FUNCTIONAL_TESTING',
      TC_NAT_ICON_NAME = 'noicon'
      where TC_NATURE='NON_FUNCTIONAL_TESTING';

update EXECUTION
      set TC_NAT_LABEL = 'test-case.nature.NAT_PERFORMANCE_TESTING',
      TC_NAT_CODE = 'NAT_PERFORMANCE_TESTING',
      TC_NAT_ICON_NAME = 'noicon'
      where TC_NATURE='PERFORMANCE_TESTING';

update EXECUTION
      set TC_NAT_LABEL = 'test-case.nature.NAT_SECURITY_TESTING',
      TC_NAT_CODE = 'NAT_SECURITY_TESTING',
      TC_NAT_ICON_NAME = 'noicon'
      where TC_NATURE='SECURITY_TESTING';

update EXECUTION
      set TC_NAT_LABEL = 'test-case.nature.NAT_ATDD',
      TC_NAT_CODE = 'NAT_ATDD',
      TC_NAT_ICON_NAME = 'noicon'
      where TC_NATURE='ATDD';

update EXECUTION
      set TC_TYP_LABEL = 'test-case.type.TYP_UNDEFINED',
      TC_TYP_CODE = 'TYP_UNDEFINED',
      TC_TYP_ICON_NAME = 'noicon'
      where TC_TYPE='UNDEFINED';

update EXECUTION
      set TC_TYP_LABEL = 'test-case.type.TYP_COMPLIANCE_TESTING',
      TC_TYP_CODE = 'TYP_COMPLIANCE_TESTING',
      TC_TYP_ICON_NAME = 'noicon'
      where TC_TYPE='COMPLIANCE_TESTING';

update EXECUTION
      set TC_TYP_LABEL = 'test-case.type.TYP_CORRECTION_TESTING',
      TC_TYP_CODE = 'TYP_CORRECTION_TESTING',
      TC_TYP_ICON_NAME = 'noicon'
      where TC_TYPE='CORRECTION_TESTING';

update EXECUTION
      set TC_TYP_LABEL = 'test-case.type.TYP_EVOLUTION_TESTING',
      TC_TYP_CODE = 'TYP_EVOLUTION_TESTING',
      TC_TYP_ICON_NAME = 'noicon'
      where TC_TYPE='EVOLUTION_TESTING';

update EXECUTION
      set TC_TYP_LABEL = 'test-case.type.TYP_REGRESSION_TESTING',
      TC_TYP_CODE = 'TYP_REGRESSION_TESTING',
      TC_TYP_ICON_NAME = 'noicon'
      where TC_TYPE='REGRESSION_TESTING';

update EXECUTION
      set TC_TYP_LABEL = 'test-case.type.TYP_END_TO_END_TESTING',
      TC_TYP_CODE = 'TYP_END_TO_END_TESTING',
      TC_TYP_ICON_NAME = 'noicon'
      where TC_TYPE='END_TO_END_TESTING';

update EXECUTION
      set TC_TYP_LABEL = 'test-case.type.TYP_PARTNER_TESTING',
      TC_TYP_CODE = 'TYP_PARTNER_TESTING',
      TC_TYP_ICON_NAME = 'noicon'
      where TC_TYPE='PARTNER_TESTING';

ALTER TABLE EXECUTION DROP COLUMN TC_NATURE;

ALTER TABLE EXECUTION DROP COLUMN TC_TYPE;

INSERT INTO databasechangelog (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('bsiri', 'migrating the columns from EXECUTION', NOW(), 'Custom SQL, Drop Column (x2)', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml', 'tm-1.12.0.feat-4068-8', '2.0.5', '3:b8affe1b87f9e96de5b10ccde72af5eb', 353);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml::tm-1.12.0.feat-4068-9::bsiri::(Checksum: 3:25497b1b6e1fd30ea715be83c5066f07)
-- update the sequences afterward
SELECT setval('info_list_info_list_id_seq', (SELECT MAX(info_list_id) from info_list));

SELECT setval('info_list_item_item_id_seq', (SELECT MAX(item_id) from info_list_item));

INSERT INTO databasechangelog (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('bsiri', 'update the sequences afterward', 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.12.0.xml', 'tm-1.12.0.feat-4068-9', '2.0.5', '3:25497b1b6e1fd30ea715be83c5066f07', 354);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml::tm-1.12.0.feat-3764-1::flaurens::(Checksum: 3:21c3ab2714d4b811be9cc596b5dc110b)
-- Tables for OAuth2 Support
CREATE TABLE oauth_client_details (CLIENT_ID VARCHAR(255) NOT NULL, CLIENT_SECRET VARCHAR(255), RESOURCE_IDS VARCHAR(255) DEFAULT null, SCOPE VARCHAR(255) DEFAULT 'location,locationhistory', AUTHORIZED_GRANT_TYPES VARCHAR(255) DEFAULT 'password,authorization_code,refresh_token,implicit', WEB_SERVER_REDIRECT_URI VARCHAR(255) DEFAULT null, AUTHORITIES VARCHAR(255) DEFAULT 'ROLE_CLIENT, ROLE_TRUSTED_CLIENT', ACCESS_TOKEN_VALIDITY BIGINT DEFAULT 60, REFRESH_TOKEN_VALIDITY BIGINT DEFAULT NULL, ADDITIONAL_INFORMATION TEXT DEFAULT null, AUTOAPPROVE VARCHAR(255), CONSTRAINT PK_OAUTH_CLIENT_DETAILS PRIMARY KEY (CLIENT_ID));

CREATE TABLE oauth_client_token (TOKEN_ID VARCHAR(255) NOT NULL, TOKEN BYTEA, AUTHENTICATION_ID VARCHAR(255), USER_NAME VARCHAR(255), CLIENT_ID VARCHAR(255), CONSTRAINT PK_OAUTH_CLIENT_TOKEN PRIMARY KEY (TOKEN_ID), UNIQUE (AUTHENTICATION_ID));

CREATE TABLE oauth_access_token (TOKEN_ID VARCHAR(255) NOT NULL, TOKEN BYTEA, AUTHENTICATION_ID VARCHAR(255), USER_NAME VARCHAR(255), CLIENT_ID VARCHAR(255), AUTHENTICATION BYTEA, REFRESH_TOKEN VARCHAR(255), CONSTRAINT PK_OAUTH_ACCESS_TOKEN PRIMARY KEY (TOKEN_ID), UNIQUE (AUTHENTICATION_ID));

CREATE TABLE oauth_refresh_token (TOKEN_ID VARCHAR(255) NOT NULL, TOKEN BYTEA, AUTHENTICATION BYTEA, CONSTRAINT PK_OAUTH_REFRESH_TOKEN PRIMARY KEY (TOKEN_ID));

CREATE TABLE oauth_code (CODE VARCHAR(255) NOT NULL, AUTHENTICATION BYTEA, CONSTRAINT PK_OAUTH_CODE PRIMARY KEY (CODE));

CREATE TABLE oauth_approvals (USERID VARCHAR(255) NOT NULL, CLIENTID VARCHAR(255) NOT NULL, SCOPE VARCHAR(255), STATUS VARCHAR(10), EXPIRESAT TIMESTAMP WITH TIME ZONE, LASTMODIFIEDAT TIMESTAMP WITH TIME ZONE);

ALTER TABLE oauth_approvals ADD CONSTRAINT PK_OAUTH_APPROVALS PRIMARY KEY (USERID, CLIENTID);

INSERT INTO databasechangelog (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('flaurens', 'Tables for OAuth2 Support', NOW(), 'Create Table (x6), Add Primary Key', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml', 'tm-1.12.0.feat-3764-1', '2.0.5', '3:21c3ab2714d4b811be9cc596b5dc110b', 355);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml::tm-1.12.0.feat-4171-1::jsimon::(Checksum: 3:dd54d7c418be3b34e621732aeec03876)
INSERT INTO CORE_CONFIG (STR_KEY, VALUE) VALUES ('uploadfilter.fileExtensions.whitelist', 'txt, doc, xls, ppt, docx, xlsx, pptx, odt, ods, odp, pdf');

INSERT INTO CORE_CONFIG (STR_KEY, VALUE) VALUES ('uploadfilter.upload.sizeLimitInBytes', '4000000');

INSERT INTO CORE_CONFIG (STR_KEY, VALUE) VALUES ('uploadfilter.upload.import.sizeLimitInBytes', '2000000');

INSERT INTO databasechangelog (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('jsimon', '', NOW(), '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.12.0.xml', 'tm-1.12.0.feat-4171-1', '2.0.5', '3:dd54d7c418be3b34e621732aeec03876', 356);

-- Changeset /var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml::tm-1.12.0.feat-3611-1::bsiri::(Checksum: 3:d1140a9da46292ae1e018a543c387b8d)
-- Creating the tables modeling the relationships between milestones and test cases, requirement versions 
--     		and campaigns
CREATE TABLE MILESTONE_TEST_CASE (MILESTONE_ID BIGINT NOT NULL, TEST_CASE_ID BIGINT NOT NULL, CONSTRAINT milestone_tc_tc FOREIGN KEY (TEST_CASE_ID) REFERENCES TEST_CASE(TCLN_ID), CONSTRAINT milestone_tc_milestone FOREIGN KEY (MILESTONE_ID) REFERENCES MILESTONE(MILESTONE_ID));

COMMENT ON COLUMN MILESTONE_TEST_CASE.MILESTONE_ID IS 'foreign key to table MILESTONE';

COMMENT ON COLUMN MILESTONE_TEST_CASE.TEST_CASE_ID IS 'foreign key to table TEST_CASE';

CREATE TABLE MILESTONE_REQ_VERSION (MILESTONE_ID BIGINT NOT NULL, REQ_VERSION_ID BIGINT NOT NULL, CONSTRAINT milestone_rqv_milestone FOREIGN KEY (MILESTONE_ID) REFERENCES MILESTONE(MILESTONE_ID), CONSTRAINT milestone_rqv_rqv FOREIGN KEY (REQ_VERSION_ID) REFERENCES REQUIREMENT_VERSION(RES_ID));

COMMENT ON COLUMN MILESTONE_REQ_VERSION.MILESTONE_ID IS 'foreign key to table MILESTONE';

COMMENT ON COLUMN MILESTONE_REQ_VERSION.REQ_VERSION_ID IS 'foreign key to table REQUIREMENT_VERSION';

CREATE TABLE MILESTONE_CAMPAIGN (MILESTONE_ID BIGINT NOT NULL, CAMPAIGN_ID BIGINT NOT NULL, CONSTRAINT milestone_camp_milestone FOREIGN KEY (MILESTONE_ID) REFERENCES MILESTONE(MILESTONE_ID), CONSTRAINT milestone_camp_camp FOREIGN KEY (CAMPAIGN_ID) REFERENCES CAMPAIGN(CLN_ID));

COMMENT ON COLUMN MILESTONE_CAMPAIGN.MILESTONE_ID IS 'foreign key to table MILESTONE';

COMMENT ON COLUMN MILESTONE_CAMPAIGN.CAMPAIGN_ID IS 'foreign key to table CAMPAIGN';

INSERT INTO databasechangelog (AUTHOR, COMMENTS, DATEEXECUTED, DESCRIPTION, EXECTYPE, FILENAME, ID, LIQUIBASE, MD5SUM, ORDEREXECUTED) VALUES ('bsiri', 'Creating the tables modeling the relationships between milestones and test cases, requirement versions 
    		and campaigns', NOW(), 'Create Table (x3)', 'EXECUTED', '/var/lib/jenkins/jobs/build-squash-tm-distros-1.21/workspace/standalone/target/maven-shared-archive-resources/tm/tm.changelog-1.12.0.xml', 'tm-1.12.0.feat-3611-1', '2.0.5', '3:d1140a9da46292ae1e018a543c387b8d', 357);

-- Release Database Lock
-- Release Database Lock
