<?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_log;;

            DROP TABLE IF EXISTS `upcs_log`;;
            CREATE TABLE `upcs_log`(
                upc bigint(20) unsigned NOT NULL COMMENT 'unique UPC.',
                status enum('used', 'unused', 'claimed') NOT NULL DEFAULT 'unused' COMMENT 'status of the upc.',
                last_updated datetime NOT NULL COMMENT 'date time at which the upc status was updated',
                log_date_utc datetime(6) NOT NULL COMMENT 'microsecond precision',
                log_action enum('insert', 'update', 'delete') DEFAULT NULL comment 'type of logging action',
                KEY `upcs_log_idx0` (`upc`),
                KEY `upcs_log_idx1` (`log_date_utc`)
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8;;
        </sql>
        <rollback>
            <sql dbms="mysql" endDelimiter=";;" splitStatements="true" stripComments="true">
                USE art_relations_log;;

                DROP TABLE IF EXISTS `upcs_log`;;
            </sql>
        </rollback>
    </changeSet>
</databaseChangeLog>
