<?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="ajain">
        <sql dbms="mysql" endDelimiter=";;" splitStatements="true" stripComments="true">
            DROP TABLE IF EXISTS `ROLLBACK-DIG-2307-not_for_distribution`;;
           
            CREATE TABLE `ROLLBACK-DIG-2307-not_for_distribution`(
                SELECT release_id, not_for_distribution FROM releases 
                WHERE not_for_distribution = 'AccountingDummy' AND product_subtype_id = 45
            );;
           
            UPDATE releases SET not_for_distribution = 'TVSeasonAccountingDummy'
            WHERE not_for_distribution = 'AccountingDummy' AND product_subtype_id = 45;;
        </sql>
        <rollback>
            UPDATE releases r 
            INNER JOIN `ROLLBACK-DIG-2307-not_for_distribution` rb
            ON r.release_id = rb.release_id SET r.not_for_distribution = 'AccountingDummy';;
           
            DROP TABLE IF EXISTS `ROLLBACK-DIG-2307-not_for_distribution`;;
        </rollback>
    </changeSet>
</databaseChangeLog>

