<?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="mdadhania">
        <sql dbms="mysql" endDelimiter=";;" splitStatements="true" stripComments="true">
            <![CDATA[
                INSERT INTO release_manual_adjustment (date_created, created_by, category_id, release_id, amount, currencies_id, description, vendor_manual_adjustment_id) 
                    VALUES ('2016-04-26 10:30:33', '261', '61', '1814799', -25000.000000, '1', 'Hunt for the Wilderpeople - Mark Woollen & Associates, theatrical trailer', '266175');;
                INSERT INTO release_manual_adjustment (date_created, created_by, category_id, release_id, amount, currencies_id, description, vendor_manual_adjustment_id) 
                    VALUES ('2016-04-26 10:30:33', '261', '60', '1814799', -1500.000000, '1', 'Hunt for the Wilderpeople - Siren Studios (Thunk Enterprises), commentary', '266175');;
                INSERT INTO release_manual_adjustment (date_created, created_by, category_id, release_id, amount, currencies_id, description, vendor_manual_adjustment_id) 
                    VALUES ('2016-04-26 10:30:33', '261', '60', '1814799', -3000.000000, '1', 'Hunt for the Wilderpeople - MPAA. Classification', '266175');;
                INSERT INTO release_manual_adjustment (date_created, created_by, category_id, release_id, amount, currencies_id, description, vendor_manual_adjustment_id) 
                    VALUES ('2016-04-26 10:30:33', '261', '61', '1814799', -500.000000, '1', 'Hunt for the Wilderpeople - Cindi J. Robinson', '266175');;

                UPDATE manual_adjustment 
                    SET amount = -30000.000000, amount_in_original_currency = -30000.000000, category_id = '65', 
                        `comment` = 'Expenses (4)', updated_timestamp = '2016-04-26 10:30:33'
                WHERE id = 266175;;

                DELETE FROM manual_adjustment WHERE id IN (266176, 266177, 266178);;
            ]]>
        </sql>
        <rollback>
            <sql dbms="mysql" endDelimiter=";;" splitStatements="true" stripComments="true">
                <![CDATA[
                    DELETE FROM release_manual_adjustment WHERE vendor_manual_adjustment_id = 266175;;

                    UPDATE manual_adjustment 
                        SET amount = -25000.000000, amount_in_original_currency = -25000.000000, category_id = '61', 
                            `comment` = 'Hunt for the Wilderpeople - Mark Woollen & Associates, theatrical trailer', updated_timestamp = '2016-04-26 10:30:33'
                    WHERE id = 266175;;

                    INSERT INTO manual_adjustment (id, parent_type, parent_id, date_added, created_by, amount, `comment`, category_id, adjust_for_period_id, apply_to_period_id, currencies_id, amount_in_original_currency, updated_timestamp) 
                        VALUES ('266176', 'vendor', '25296', '2016-04-26 10:30:33', '261', -1500.000000, 'Hunt for the Wilderpeople - Siren Studios (Thunk Enterprises), commentary', '60', '207', '207', '1', '-1500.000000', '2016-04-26 10:30:33');;
                    INSERT INTO manual_adjustment (id, parent_type, parent_id, date_added, created_by, amount, `comment`, category_id, adjust_for_period_id, apply_to_period_id, currencies_id, amount_in_original_currency, updated_timestamp) 
                        VALUES ('266177', 'vendor', '25296', '2016-04-26 10:30:33', '261', -3000.000000, 'Hunt for the Wilderpeople - MPAA. Classification', '60', '207', '207', '1', '-3000.000000', '2016-04-26 10:30:33');;
                    INSERT INTO manual_adjustment (id, parent_type, parent_id, date_added, created_by, amount, `comment`, category_id, adjust_for_period_id, apply_to_period_id, currencies_id, amount_in_original_currency, updated_timestamp) 
                        VALUES ('266178', 'vendor', '25296', '2016-04-26 10:30:33', '261', -500.000000, 'Hunt for the Wilderpeople - Cindi J. Robinson', '61', '207', '207', '1', '-500.000000', '2016-04-26 10:30:33');;
                ]]>
            </sql>
        </rollback>
    </changeSet>
    <changeSet id="2" author="mdadhania">
        <sql dbms="mysql" endDelimiter=";;" splitStatements="true" stripComments="true">	
            <![CDATA[
                INSERT INTO release_manual_adjustment (date_created, created_by, category_id, release_id, amount, currencies_id, description, vendor_manual_adjustment_id) 
                    VALUES ('2016-08-03 16:55:29', '261', '52', '1814799', -532.880000, '1', 'Q216 quarterly sales foreign withholding tax on US sales', '275609');;

                UPDATE manual_adjustment 
                    SET amount = amount - 532.880000, amount_in_original_currency = amount_in_original_currency - 532.880000, 
                        `comment` = 'Expenses (71)',  updated_timestamp = '2016-08-03 16:55:29'
                WHERE id = 275609;;

                DELETE FROM manual_adjustment WHERE id = 279336;;
            ]]>
        </sql>
        <rollback>
            <sql dbms="mysql" endDelimiter=";;" splitStatements="true" stripComments="true">
                <![CDATA[
                    DELETE FROM release_manual_adjustment 
                        WHERE vendor_manual_adjustment_id = 275609 AND amount = -532.880000 AND description = 'Q216 quarterly sales foreign withholding tax on US sales';;

                    UPDATE manual_adjustment 
                        SET amount = amount + 532.880000, amount_in_original_currency = amount_in_original_currency + 532.880000,
                            `comment` = 'Expenses (70)', updated_timestamp = '2016-07-21 16:50:41'
                    WHERE id = 275609;;

                    INSERT INTO manual_adjustment (id, parent_type, parent_id, date_added, created_by, amount, `comment`, category_id, adjust_for_period_id, apply_to_period_id, currencies_id, amount_in_original_currency, updated_timestamp) 
                        VALUES ('279336', 'vendor', '25296', '2016-08-03 16:55:29', '261', -532.880000, 'Q216 quarterly sales foreign withholding tax on US sales', '52', '210', '210', '1', '-532.880000', '2016-08-03 16:55:29');;
                ]]>
            </sql>
        </rollback>
    </changeSet>
</databaseChangeLog>
