<?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="pshrivastava">
        <sql dbms="mysql" endDelimiter=";;" splitStatements="true" stripComments="true">
            USE art_relations;;
            CREATE TABLE IF NOT EXISTS physical_order_targets (
                order_target_id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                type ENUM('HMV','Indie','International') DEFAULT NULL,
                target INT(11) UNSIGNED NOT NULL,
                product_id INT(11) UNSIGNED NOT NULL,
                last_updated TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
                PRIMARY KEY (order_target_id),
                KEY FK_physical_order_targets_physical_id (product_id),
                CONSTRAINT FK_physical_order_targets_physical_id FOREIGN KEY (product_id) REFERENCES product_physical (id)
            )ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Holds data for physical stock allocation';;
        </sql>
        <rollback>
            <sql dbms="mysql" endDelimiter=";;" splitStatements="true" stripComments="true">
                USE art_relations;;
                DROP TABLE IF EXISTS physical_order_targets;;
            </sql>
        </rollback>
    </changeSet>
</databaseChangeLog>
