<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<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-3.5.xsd"
                   logicalFilePath="migration/node-services.changelog-init.xml">

    <changeSet author="R3.Corda" id="add-new-pk-hash-to-pk-table" dbms="h2,mssql">
        <createTable tableName="node_hash_to_key">
            <column name="pk_hash" type="NVARCHAR(130)">
                <constraints nullable="false"/>
            </column>
            <column name="public_key" type="blob">
                <constraints nullable="false"/>
            </column>
        </createTable>
        <addPrimaryKey columnNames="pk_hash" constraintName="node_hash_to_key_pk_hash" tableName="node_hash_to_key"/>
    </changeSet>

    <changeSet author="R3.Corda" id="add-new-pk-hash-to-pk-table-postgresql" dbms="postgresql">
        <createTable tableName="node_hash_to_key">
            <column name="pk_hash" type="NVARCHAR(130)">
                <constraints nullable="false"/>
            </column>
            <column name="public_key" type="varbinary(64000)">
                <constraints nullable="false"/>
            </column>
        </createTable>
        <addPrimaryKey columnNames="pk_hash" constraintName="node_hash_to_key_pk_hash" tableName="node_hash_to_key"/>
    </changeSet>

</databaseChangeLog>