<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd" >
    <changeSet author="R3.Corda" id="1511451595465-2">
        <createTable tableName="contract_cash_states">
            <column name="output_index" type="INT">
                <constraints nullable="false"/>
            </column>
            <column name="transaction_id" type="NVARCHAR(64)">
                <constraints nullable="false"/>
            </column>
            <column name="ccy_code" type="NVARCHAR(3)"/>
            <column name="issuer_key_hash" type="NVARCHAR(130)"/>
            <column name="issuer_ref" type="varbinary(512)"/>
            <column name="owner_name" type="NVARCHAR(255)"/>
            <column name="pennies" type="BIGINT"/>
        </createTable>
    </changeSet>
    <changeSet author="R3.Corda" id="1511451595465-28">
        <addPrimaryKey columnNames="output_index, transaction_id" constraintName="contract_cash_states_pkey" tableName="contract_cash_states"/>
    </changeSet>
    <changeSet author="R3.Corda" id="1511451595465-51">
        <createIndex indexName="ccy_code_idx" tableName="contract_cash_states">
            <column name="ccy_code"/>
        </createIndex>
    </changeSet>
    <changeSet author="R3.Corda" id="1511451595465-57">
        <createIndex indexName="pennies_idx" tableName="contract_cash_states">
            <column name="pennies"/>
        </createIndex>
    </changeSet>
    <changeSet id="non-clustered_pk-cash" author="R3.Corda" onValidationFail="MARK_RAN">
        <dropPrimaryKey tableName="contract_cash_states" constraintName="contract_cash_states_pkey"/>
        <addPrimaryKey tableName="contract_cash_states" columnNames="output_index, transaction_id"
                       constraintName="contract_cash_states_pkey" clustered="false"/>
    </changeSet>

</databaseChangeLog>
