From f4621d9a744d7b69f3f862a3715208fb005ba220 Mon Sep 17 00:00:00 2001 From: Maksymilian Pawlak Date: Tue, 5 Jun 2018 18:13:49 +0100 Subject: [PATCH] [CORDA-1297] Column nullability in migrations (#916) * Migrations to proper nullability * Removed node-core.changelog-v3-GA.xml file as indicated by PR comments, This change was already provided by nullability upgrade commits --- .../migration/cash.changelog-master.xml | 1 + .../resources/migration/cash.changelog-v1.xml | 11 +++-- .../commercial-paper.changelog-master.xml | 1 + .../commercial-paper.changelog-v1.xml | 24 +++++++++++ .../sample-cash-v1.changelog-init.xml | 20 ++++++--- .../sample-cash-v2.changelog-init.xml | 12 ++++-- .../sample-cash-v3.changelog-init.xml | 24 ++++++++--- .../migration/sample-cp-v1.changelog-init.xml | 32 +++++++++++---- .../migration/sample-cp-v2.changelog-init.xml | 36 ++++++++++++---- .../message-schema.changelog-init.xml | 5 +++ .../services/persistence/RunOnceService.kt | 8 ++-- .../migration/node-core.changelog-master.xml | 3 +- .../migration/node-core.changelog-v4.xml | 41 +++++++++++++++++++ .../migration/node-info.changelog-init.xml | 1 + .../migration/node-info.changelog-master.xml | 1 + .../migration/node-info.changelog-v2.xml | 27 ++++++++++++ .../node-notary.changelog-master.xml | 1 + .../migration/node-notary.changelog-v1.xml | 26 ++++++++++++ .../vault-schema.changelog-master.xml | 1 + .../migration/vault-schema.changelog-v4.xml | 21 ++++++++++ .../dummy-linear-v1.changelog-init.xml | 6 +++ .../dummy-linear-v2.changelog-init.xml | 6 +++ 22 files changed, 268 insertions(+), 40 deletions(-) rename node/src/main/resources/migration/node-core.changelog-v3-GA.xml => finance/src/main/resources/migration/cash.changelog-v1.xml (52%) create mode 100644 finance/src/main/resources/migration/commercial-paper.changelog-v1.xml create mode 100644 node/src/main/resources/migration/node-core.changelog-v4.xml create mode 100644 node/src/main/resources/migration/node-info.changelog-v2.xml create mode 100644 node/src/main/resources/migration/node-notary.changelog-v1.xml create mode 100644 node/src/main/resources/migration/vault-schema.changelog-v4.xml diff --git a/finance/src/main/resources/migration/cash.changelog-master.xml b/finance/src/main/resources/migration/cash.changelog-master.xml index db0ebd555a..4c1b7c5eb0 100644 --- a/finance/src/main/resources/migration/cash.changelog-master.xml +++ b/finance/src/main/resources/migration/cash.changelog-master.xml @@ -12,5 +12,6 @@ + diff --git a/node/src/main/resources/migration/node-core.changelog-v3-GA.xml b/finance/src/main/resources/migration/cash.changelog-v1.xml similarity index 52% rename from node/src/main/resources/migration/node-core.changelog-v3-GA.xml rename to finance/src/main/resources/migration/cash.changelog-v1.xml index 204fdaec6e..d1b8b9b554 100644 --- a/node/src/main/resources/migration/node-core.changelog-v3-GA.xml +++ b/finance/src/main/resources/migration/cash.changelog-v1.xml @@ -5,8 +5,11 @@ 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"> - - + + + + + - + \ No newline at end of file diff --git a/finance/src/main/resources/migration/commercial-paper.changelog-master.xml b/finance/src/main/resources/migration/commercial-paper.changelog-master.xml index 11428c1ff8..0eea96be21 100644 --- a/finance/src/main/resources/migration/commercial-paper.changelog-master.xml +++ b/finance/src/main/resources/migration/commercial-paper.changelog-master.xml @@ -12,5 +12,6 @@ + diff --git a/finance/src/main/resources/migration/commercial-paper.changelog-v1.xml b/finance/src/main/resources/migration/commercial-paper.changelog-v1.xml new file mode 100644 index 0000000000..be7638e4fe --- /dev/null +++ b/finance/src/main/resources/migration/commercial-paper.changelog-v1.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + diff --git a/finance/src/test/resources/migration/sample-cash-v1.changelog-init.xml b/finance/src/test/resources/migration/sample-cash-v1.changelog-init.xml index 171d052aff..f82108246a 100644 --- a/finance/src/test/resources/migration/sample-cash-v1.changelog-init.xml +++ b/finance/src/test/resources/migration/sample-cash-v1.changelog-init.xml @@ -21,11 +21,21 @@ - - - - - + + + + + + + + + + + + + + + diff --git a/finance/src/test/resources/migration/sample-cash-v2.changelog-init.xml b/finance/src/test/resources/migration/sample-cash-v2.changelog-init.xml index 856e0c21a1..f75eeb6782 100644 --- a/finance/src/test/resources/migration/sample-cash-v2.changelog-init.xml +++ b/finance/src/test/resources/migration/sample-cash-v2.changelog-init.xml @@ -23,10 +23,16 @@ - + + + - - + + + + + + - - - - - + + + + + + + + + + + + + + + - + + + diff --git a/finance/src/test/resources/migration/sample-cp-v1.changelog-init.xml b/finance/src/test/resources/migration/sample-cp-v1.changelog-init.xml index 7cd2118e3d..5af035c5c1 100644 --- a/finance/src/test/resources/migration/sample-cp-v1.changelog-init.xml +++ b/finance/src/test/resources/migration/sample-cp-v1.changelog-init.xml @@ -21,14 +21,30 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/finance/src/test/resources/migration/sample-cp-v2.changelog-init.xml b/finance/src/test/resources/migration/sample-cp-v2.changelog-init.xml index 4c9eae6d69..11f463fc05 100644 --- a/finance/src/test/resources/migration/sample-cp-v2.changelog-init.xml +++ b/finance/src/test/resources/migration/sample-cp-v2.changelog-init.xml @@ -21,14 +21,30 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + \ No newline at end of file diff --git a/node/src/main/kotlin/net/corda/node/services/persistence/RunOnceService.kt b/node/src/main/kotlin/net/corda/node/services/persistence/RunOnceService.kt index 38d2c3839f..384422b8fb 100644 --- a/node/src/main/kotlin/net/corda/node/services/persistence/RunOnceService.kt +++ b/node/src/main/kotlin/net/corda/node/services/persistence/RunOnceService.kt @@ -66,16 +66,16 @@ class RunOnceService(private val database: CordaPersistence, private val machine @Id val id: Char = 'X' - @Column(name = MACHINE_NAME) + @Column(name = MACHINE_NAME, nullable = false) val machineName = machineNameInit - @Column(name = PID) + @Column(name = PID, nullable = false) val pid = pidInit - @Column(name = TIMESTAMP) + @Column(name = TIMESTAMP, nullable = false) val timestamp = timeStampInit - @Column(name = VERSION) + @Column(name = VERSION, nullable = false) val version = versionInit } diff --git a/node/src/main/resources/migration/node-core.changelog-master.xml b/node/src/main/resources/migration/node-core.changelog-master.xml index 2e039e8fae..c3f3f61022 100644 --- a/node/src/main/resources/migration/node-core.changelog-master.xml +++ b/node/src/main/resources/migration/node-core.changelog-master.xml @@ -16,5 +16,6 @@ - + + diff --git a/node/src/main/resources/migration/node-core.changelog-v4.xml b/node/src/main/resources/migration/node-core.changelog-v4.xml new file mode 100644 index 0000000000..203b89b95a --- /dev/null +++ b/node/src/main/resources/migration/node-core.changelog-v4.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/node/src/main/resources/migration/node-info.changelog-init.xml b/node/src/main/resources/migration/node-info.changelog-init.xml index 4c2ffafa2d..3f339ab058 100644 --- a/node/src/main/resources/migration/node-info.changelog-init.xml +++ b/node/src/main/resources/migration/node-info.changelog-init.xml @@ -78,6 +78,7 @@ referencedColumnNames="node_info_id" referencedTableName="node_infos"/> + diff --git a/node/src/main/resources/migration/node-info.changelog-master.xml b/node/src/main/resources/migration/node-info.changelog-master.xml index b309c209a8..a0184a9953 100644 --- a/node/src/main/resources/migration/node-info.changelog-master.xml +++ b/node/src/main/resources/migration/node-info.changelog-master.xml @@ -16,5 +16,6 @@ + diff --git a/node/src/main/resources/migration/node-info.changelog-v2.xml b/node/src/main/resources/migration/node-info.changelog-v2.xml new file mode 100644 index 0000000000..54ae0bf3e2 --- /dev/null +++ b/node/src/main/resources/migration/node-info.changelog-v2.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/node/src/main/resources/migration/node-notary.changelog-master.xml b/node/src/main/resources/migration/node-notary.changelog-master.xml index 097f750a17..2071ac683a 100644 --- a/node/src/main/resources/migration/node-notary.changelog-master.xml +++ b/node/src/main/resources/migration/node-notary.changelog-master.xml @@ -15,5 +15,6 @@ 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"> + diff --git a/node/src/main/resources/migration/node-notary.changelog-v1.xml b/node/src/main/resources/migration/node-notary.changelog-v1.xml new file mode 100644 index 0000000000..33bc92036b --- /dev/null +++ b/node/src/main/resources/migration/node-notary.changelog-v1.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/node/src/main/resources/migration/vault-schema.changelog-master.xml b/node/src/main/resources/migration/vault-schema.changelog-master.xml index ae0c268e9e..feefdc18dc 100644 --- a/node/src/main/resources/migration/vault-schema.changelog-master.xml +++ b/node/src/main/resources/migration/vault-schema.changelog-master.xml @@ -16,5 +16,6 @@ + diff --git a/node/src/main/resources/migration/vault-schema.changelog-v4.xml b/node/src/main/resources/migration/vault-schema.changelog-v4.xml new file mode 100644 index 0000000000..e26a43d644 --- /dev/null +++ b/node/src/main/resources/migration/vault-schema.changelog-v4.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + diff --git a/testing/test-utils/src/main/resources/migration/dummy-linear-v1.changelog-init.xml b/testing/test-utils/src/main/resources/migration/dummy-linear-v1.changelog-init.xml index 8dbd82eb03..794c84bed5 100644 --- a/testing/test-utils/src/main/resources/migration/dummy-linear-v1.changelog-init.xml +++ b/testing/test-utils/src/main/resources/migration/dummy-linear-v1.changelog-init.xml @@ -51,4 +51,10 @@ + + + + + + diff --git a/testing/test-utils/src/main/resources/migration/dummy-linear-v2.changelog-init.xml b/testing/test-utils/src/main/resources/migration/dummy-linear-v2.changelog-init.xml index 3ce3aafc0b..22ae56116e 100644 --- a/testing/test-utils/src/main/resources/migration/dummy-linear-v2.changelog-init.xml +++ b/testing/test-utils/src/main/resources/migration/dummy-linear-v2.changelog-init.xml @@ -51,4 +51,10 @@ referencedTableName="dummy_linear_states_v2"/> + + + + + +