<?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"
                   logicalFilePath="migration/node-services.changelog-init.xml">

    <changeSet id="1525793504" author="R3.Corda">
        <!-- drop indexes before adding not null constraints to the underlying table, recreating index immediately after -->
        <dropIndex indexName="ccy_code_idx" tableName="contract_cash_states"/>
        <addNotNullConstraint tableName="contract_cash_states" columnName="ccy_code" columnDataType="NVARCHAR(3)"/>
        <createIndex indexName="ccy_code_idx" tableName="contract_cash_states">
            <column name="ccy_code"/>
        </createIndex>

        <addNotNullConstraint tableName="contract_cash_states" columnName="issuer_key_hash"
                              columnDataType="NVARCHAR(130)"/>
        <addNotNullConstraint tableName="contract_cash_states" columnName="issuer_ref" columnDataType="varbinary(512)"/>

        <!-- drop indexes before adding not null constraints to the underlying table, recreating index immediately after -->
        <dropIndex indexName="pennies_idx" tableName="contract_cash_states"/>
        <addNotNullConstraint tableName="contract_cash_states" columnName="pennies" columnDataType="BIGINT"/>
        <createIndex indexName="pennies_idx" tableName="contract_cash_states">
            <column name="pennies"/>
        </createIndex>
    </changeSet>
</databaseChangeLog>
