<?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"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">

    <changeSet id="028-add-batch-id-to-production-orders" author="effigenix">
        <addColumn tableName="production_orders">
            <column name="batch_id" type="VARCHAR(36)"/>
        </addColumn>

        <addForeignKeyConstraint
                baseTableName="production_orders"
                baseColumnNames="batch_id"
                constraintName="fk_production_orders_batch_id"
                referencedTableName="batches"
                referencedColumnNames="id"/>

        <addUniqueConstraint tableName="production_orders"
                columnNames="batch_id"
                constraintName="uq_production_orders_batch_id"/>
    </changeSet>

</databaseChangeLog>
