<?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="skanchan">
        <sql dbms="mysql" endDelimiter=";;" splitStatements="true" stripComments="true">
        <![CDATA[
            CREATE TABLE `ROLLBACK-VC-1742-1`
            SELECT vc.vendor_contract_id
            FROM vw_active_vendor_contract vc
            WHERE vc.vendor_id IN (7570, 11055, 11220, 13905, 13908, 13919, 13945, 13976, 13989, 13992, 14006, 14066, 14067, 14072, 14077, 14078, 14079, 14128, 14130, 14646, 18069, 18557, 18910, 19612, 20016, 20858, 21918, 21919, 21924, 21968, 21985, 22207, 22256, 22342, 22418, 26291);;

            INSERT INTO vendor_dms_master_restriction (customer_master_master_id, vendor_contract_id, distribution_type_id, last_updated, updated_by)
            SELECT 736, vendor_contract_id, 1, CURRENT_TIMESTAMP, 767 FROM `ROLLBACK-VC-1742-1`;;
        ]]>
        </sql>
        <rollback>
            <sql dbms="mysql" endDelimiter=";;" splitStatements="true" stripComments="true">
            <![CDATA[
                DELETE vdmr.* FROM vendor_dms_master_restriction AS vdmr
                INNER JOIN `ROLLBACK-VC-1742-1` AS rb ON vdmr.vendor_contract_id = rb.vendor_contract_id
                WHERE vdmr.customer_master_master_id = 736 AND vdmr.distribution_type_id = 1 AND vdmr.updated_by = 767;;

                DROP TABLE `ROLLBACK-VC-1742-1`;;
            ]]>
            </sql>
        </rollback>
    </changeSet>
</databaseChangeLog>
