<?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">
            CREATE TABLE `ROLLBACK-MOV-2736_AU_TV_ratings`
            SELECT * FROM release_rating_advisory_system WHERE rating_advisory_system_id IN (18,19,24);;

            DELETE FROM release_rating_advisory_system WHERE rating_advisory_system_id IN (18,19,24);;

            DELETE FROM rating_advisory_system WHERE rating_advisory_system_id IN (18,19,24);;
        </sql>
        <rollback>
            <sql dbms="mysql" endDelimiter=";;" splitStatements="true" stripComments="true">
                INSERT INTO rating_advisory_system (rating_advisory_system_id, system, video_type, `type`, `code`, description)
                    VALUES ('18', 'au-tv', 'tv', 'rating', 'P', 'Recommended for pre-schoolers');;
                INSERT INTO rating_advisory_system (rating_advisory_system_id, system, video_type, `type`, `code`, description)
                    VALUES ('19', 'au-tv', 'tv', 'rating', 'C', 'Recommended for children');;
                INSERT INTO rating_advisory_system (rating_advisory_system_id, system, video_type, `type`, `code`, description)
                    VALUES ('24', 'au-tv', 'tv', 'rating', 'AV15+', 'This programme is not recommended for people under the age of 15. In particular, it may contain intense and/or frequent violence and may also contain depictions of sexual activity, coarse language, the use of illegal drugs, mentions of suicide, and/or other adult themes.');;

                INSERT INTO release_rating_advisory_system (release_rating_advisory_system_id, upc, rating_advisory_system_id, reason, release_id)
                SELECT release_rating_advisory_system_id, upc, rating_advisory_system_id, reason, release_id
                FROM `ROLLBACK-MOV-2736_AU_TV_ratings`;;

                DROP TABLE `ROLLBACK-MOV-2736_AU_TV_ratings`;;
            </sql>
        </rollback>
    </changeSet>
</databaseChangeLog>
