<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
        xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd
        http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
    <changeSet id="1" author="ravi-yadav">
        <sql dbms="mysql" endDelimiter=";;" splitStatements="true" stripComments="true">
            USE art_relations;;

            CREATE TABLE vendor_contract_compilation(
            id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Primary key',
            vendor_contract_id INT(10) UNSIGNED NOT NULL COMMENT 'Foreign key to vendor_contract_table',
            orchard_compilation_agreement ENUM('Y','N') DEFAULT 'N' COMMENT 'Indicates the agreement for Orchard Compilation.',
            orchard_compilation_split FLOAT DEFAULT NULL COMMENT 'Orchard Compilation Split(Label Share).',
            orchard_compilation_authorization_required ENUM('Y','N') DEFAULT 'N' COMMENT 'Indicates whether Authorization Required for Orchard Compilation.',
            PRIMARY KEY (id),
            UNIQUE KEY vendor_contract_id (vendor_contract_id),
            CONSTRAINT FK_vendor_contract_id FOREIGN KEY (vendor_contract_id) REFERENCES vendor_contract (id) ON DELETE CASCADE ON UPDATE NO ACTION
            );;

        </sql>
        <rollback>
            <sql dbms="mysql" endDelimiter=";;" splitStatements="true" stripComments="true">

                USE art_relations;;

                ALTER TABLE vendor_contract_compilation 
                DROP FOREIGN KEY FK_vendor_contract_id;;
                DROP TABLE vendor_contract_compilation;;

            </sql>
        </rollback>
    </changeSet>
</databaseChangeLog>
