mirror of
https://github.com/corda/corda.git
synced 2024-12-19 04:57:58 +00:00
CORDA-3226 Fix dba migration for PostgreSQL following changes in CORDA-3009 and ENT-4192 (#5529)
* Fix dta migration for PostgreSQL following changes for CORDA-3009 Invalid hash function used for PersistentIdentity in PersistentIdentityService and ENT-4192 Identity service refactor for confidential-identities and accounts. * Different table definition for PostgreSQL and other dbs in one changeset instead of running generic DDL and the specifically fix table in Postgres (in relation to CORDA-3009 Invalid hash function used for PersistentIdentity in PersistentIdentityService and ENT-4192 Identity service refactor for confidential-identities and accounts).
This commit is contained in:
parent
ccdd5a20dd
commit
3874e0c178
@ -12,23 +12,19 @@
|
|||||||
<include file="migration/node-core.changelog-v8.xml"/>
|
<include file="migration/node-core.changelog-v8.xml"/>
|
||||||
<include file="migration/node-core.changelog-tx-mapping.xml"/>
|
<include file="migration/node-core.changelog-tx-mapping.xml"/>
|
||||||
<include file="migration/node-core.changelog-v9.xml"/>
|
<include file="migration/node-core.changelog-v9.xml"/>
|
||||||
<!-- This migration was originally written within the same script as node-core.changelog-v14-data. However, node-core.changelog-v10
|
<include file="migration/node-core.changelog-v10.xml"/>
|
||||||
|
<include file="migration/node-core.changelog-v11.xml"/>
|
||||||
|
<!-- This migration was originally written within the same script as node-core.changelog-v14-data. However, node-core.changelog-v12
|
||||||
runs a service with mapped schema which now has the new table so the table should be created before hand. The transfer of data
|
runs a service with mapped schema which now has the new table so the table should be created before hand. The transfer of data
|
||||||
can then happen later in node-core.changelog-v14-data. -->
|
can then happen later in node-core.changelog-v14-data. -->
|
||||||
<include file="migration/node-core.changelog-v14-table.xml"/>
|
<include file="migration/node-core.changelog-v14-table.xml"/>
|
||||||
<include file="migration/node-core.changelog-v10.xml"/>
|
|
||||||
<include file="migration/node-core.changelog-v11.xml"/>
|
|
||||||
<include file="migration/node-core.changelog-v12.xml"/>
|
<include file="migration/node-core.changelog-v12.xml"/>
|
||||||
<!-- This changeset (which creates extra columns in the transactions tables), must be run before the vault state migration (in
|
<!-- This migration (which creates extra columns in the transactions tables), must be run before the vault state migration (in
|
||||||
vault-schema.changelog-v9.xml), as that will use the current hibernate mappings, and those require all DB columns to be
|
vault-schema.changelog-v9.xml), as that will use the current hibernate mappings, and those require all DB columns to be created. -->
|
||||||
created. -->
|
|
||||||
<include file="migration/node-core.changelog-v13.xml"/>
|
<include file="migration/node-core.changelog-v13.xml"/>
|
||||||
<!-- This change should be done before the v14-data migration. -->
|
<!-- This change should be done before the v14-data migration. -->
|
||||||
<include file="migration/node-core.changelog-v15-table.xml"/>
|
|
||||||
<include file="migration/node-core.changelog-v15.xml"/>
|
<include file="migration/node-core.changelog-v15.xml"/>
|
||||||
|
|
||||||
<include file="migration/node-core.changelog-v16.xml"/>
|
|
||||||
|
|
||||||
<!-- This must run after node-core.changelog-init.xml, to prevent database columns being created twice. -->
|
<!-- This must run after node-core.changelog-init.xml, to prevent database columns being created twice. -->
|
||||||
<include file="migration/vault-schema.changelog-v9.xml"/>
|
<include file="migration/vault-schema.changelog-v9.xml"/>
|
||||||
|
|
||||||
|
@ -20,6 +20,18 @@
|
|||||||
|
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet author="R3.Corda" id="modify identity_value column type" dbms="postgresql">
|
||||||
|
<addColumn tableName="node_identities">
|
||||||
|
<column name="temp_identity_value" type="varbinary(64000)">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
</addColumn>
|
||||||
|
<sql>UPDATE node_identities SET temp_identity_value = lo_get(identity_value)</sql>
|
||||||
|
<addNotNullConstraint tableName="node_identities" columnName="temp_identity_value"/>
|
||||||
|
<dropColumn tableName="node_identities" columnName="identity_value"/>
|
||||||
|
<renameColumn tableName="node_identities" oldColumnName="temp_identity_value" newColumnName="identity_value"/>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
<changeSet author="R3.Corda" id="migrate_identity_service_to_use_publicKey.toShortString()">
|
<changeSet author="R3.Corda" id="migrate_identity_service_to_use_publicKey.toShortString()">
|
||||||
<customChange class="net.corda.node.migration.PersistentIdentityMigration">
|
<customChange class="net.corda.node.migration.PersistentIdentityMigration">
|
||||||
</customChange>
|
</customChange>
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
<?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">
|
|
||||||
<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>
|
|
||||||
|
|
||||||
</databaseChangeLog>
|
|
@ -1,25 +1,31 @@
|
|||||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
<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"
|
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">
|
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="modify identity_value column type" dbms="postgresql">
|
<changeSet author="R3.Corda" id="add-new-pk-hash-to-pk-table" dbms="h2,mssql">
|
||||||
|
<createTable tableName="node_hash_to_key">
|
||||||
<preConditions onFail="MARK_RAN">
|
<column name="pk_hash" type="NVARCHAR(130)">
|
||||||
<not>
|
|
||||||
<sqlCheck expectedResult="bytea">
|
|
||||||
SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'node_identities' AND COLUMN_NAME = 'identity_value'
|
|
||||||
</sqlCheck>
|
|
||||||
</not>
|
|
||||||
</preConditions>
|
|
||||||
|
|
||||||
<dropColumn tableName="node_identities" columnName="identity_value"/>
|
|
||||||
<addColumn tableName="node_identities">
|
|
||||||
<column name="identity_value" type="varbinary(64000)">
|
|
||||||
<constraints nullable="false"/>
|
<constraints nullable="false"/>
|
||||||
</column>
|
</column>
|
||||||
</addColumn>
|
<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>
|
</changeSet>
|
||||||
|
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
@ -1,21 +0,0 @@
|
|||||||
<?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="modify public_key column type" dbms="postgresql">
|
|
||||||
<preConditions onFail="MARK_RAN">
|
|
||||||
<not>
|
|
||||||
<sqlCheck expectedResult="bytea">
|
|
||||||
SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'node_hash_to_key' AND COLUMN_NAME = 'public_key'
|
|
||||||
</sqlCheck>
|
|
||||||
</not>
|
|
||||||
</preConditions>
|
|
||||||
<dropColumn tableName="node_hash_to_key" columnName="public_key"/>
|
|
||||||
<addColumn tableName="node_hash_to_key">
|
|
||||||
<column name="public_key" type="varbinary(64000)">
|
|
||||||
<constraints nullable="false"/>
|
|
||||||
</column>
|
|
||||||
</addColumn>
|
|
||||||
</changeSet>
|
|
||||||
</databaseChangeLog>
|
|
Loading…
Reference in New Issue
Block a user