From 0443ec58cd82567628c7bb6688885a9b32956da7 Mon Sep 17 00:00:00 2001 From: snehadamle Date: Wed, 29 Jul 2020 19:25:14 +0530 Subject: [PATCH 1/5] ENT-5267 Add liquibase migration scripts to samples --- Basic/constants.properties | 4 ++-- Basic/cordapp-example/build.gradle | 1 + .../java/com/example/schema/IOUSchemaV1.java | 8 +++++++ .../kotlin/com/example/schema/IOUSchema.kt | 5 ++++ Basic/cordapp-example/repositories.gradle | 1 + .../migration/iou.changelog-master.xml | 8 +++++++ .../resources/migration/iou.changelog-v1.xml | 20 ++++++++++++++++ .../resources/migration/iou.changelog-v2.xml | 14 +++++++++++ .../migration/iou.changelog-master.xml | 8 +++++++ .../resources/migration/iou.changelog-v1.xml | 20 ++++++++++++++++ .../resources/migration/iou.changelog-v2.xml | 14 +++++++++++ Features/constants.properties | 4 ++-- .../queryableState-carinsurance/build.gradle | 2 ++ .../corda/samples/schema/InsuranceSchemaV1.kt | 5 ++++ .../repositories.gradle | 1 + .../migration/claim-detail.changelog-v1.xml | 21 +++++++++++++++++ .../insurance-detail.changelog-v1.xml | 23 +++++++++++++++++++ .../migration/insurance.changelog-master.xml | 11 +++++++++ .../migration/vehicle-detail.changelog-v1.xml | 20 ++++++++++++++++ 19 files changed, 186 insertions(+), 4 deletions(-) create mode 100644 Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-master.xml create mode 100644 Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-v1.xml create mode 100644 Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-v2.xml create mode 100644 Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-master.xml create mode 100644 Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-v1.xml create mode 100644 Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-v2.xml create mode 100644 Features/queryableState-carinsurance/workflows/src/main/resources/migration/claim-detail.changelog-v1.xml create mode 100644 Features/queryableState-carinsurance/workflows/src/main/resources/migration/insurance-detail.changelog-v1.xml create mode 100644 Features/queryableState-carinsurance/workflows/src/main/resources/migration/insurance.changelog-master.xml create mode 100644 Features/queryableState-carinsurance/workflows/src/main/resources/migration/vehicle-detail.changelog-v1.xml diff --git a/Basic/constants.properties b/Basic/constants.properties index 0b0f28b2..e2d6b3ba 100644 --- a/Basic/constants.properties +++ b/Basic/constants.properties @@ -1,7 +1,7 @@ cordaReleaseGroup=net.corda cordaCoreReleaseGroup=net.corda -cordaVersion=4.5-RC02 -cordaCoreVersion=4.5-RC02 +cordaVersion=4.6-20200713_101257-adeea5c +cordaCoreVersion=4.6-20200713_101257-adeea5c gradlePluginsVersion=5.0.10 kotlinVersion=1.2.71 junitVersion=4.12 diff --git a/Basic/cordapp-example/build.gradle b/Basic/cordapp-example/build.gradle index 5bad0db2..6d70c92c 100644 --- a/Basic/cordapp-example/build.gradle +++ b/Basic/cordapp-example/build.gradle @@ -22,6 +22,7 @@ buildscript { maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-releases' } + maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-dev/' } mavenLocal() } diff --git a/Basic/cordapp-example/contracts-java/src/main/java/com/example/schema/IOUSchemaV1.java b/Basic/cordapp-example/contracts-java/src/main/java/com/example/schema/IOUSchemaV1.java index bce0354b..1263a018 100644 --- a/Basic/cordapp-example/contracts-java/src/main/java/com/example/schema/IOUSchemaV1.java +++ b/Basic/cordapp-example/contracts-java/src/main/java/com/example/schema/IOUSchemaV1.java @@ -3,6 +3,7 @@ import net.corda.core.schemas.MappedSchema; import net.corda.core.schemas.PersistentState; +import javax.annotation.Nullable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; @@ -17,6 +18,13 @@ public IOUSchemaV1() { super(IOUSchema.class, 1, Arrays.asList(PersistentIOU.class)); } + @Nullable + @Override + public String getMigrationResource() { + return "iou.changelog-master"; + } + + @Entity @Table(name = "iou_states") public static class PersistentIOU extends PersistentState { diff --git a/Basic/cordapp-example/contracts-kotlin/src/main/kotlin/com/example/schema/IOUSchema.kt b/Basic/cordapp-example/contracts-kotlin/src/main/kotlin/com/example/schema/IOUSchema.kt index c94883f3..4edb2637 100644 --- a/Basic/cordapp-example/contracts-kotlin/src/main/kotlin/com/example/schema/IOUSchema.kt +++ b/Basic/cordapp-example/contracts-kotlin/src/main/kotlin/com/example/schema/IOUSchema.kt @@ -19,6 +19,11 @@ object IOUSchemaV1 : MappedSchema( schemaFamily = IOUSchema.javaClass, version = 1, mappedTypes = listOf(PersistentIOU::class.java)) { + + override val migrationResource: String? + get() = "iou.changelog-master"; + + @Entity @Table(name = "iou_states") class PersistentIOU( diff --git a/Basic/cordapp-example/repositories.gradle b/Basic/cordapp-example/repositories.gradle index 2874c2ab..db6ab8db 100644 --- a/Basic/cordapp-example/repositories.gradle +++ b/Basic/cordapp-example/repositories.gradle @@ -4,5 +4,6 @@ repositories { jcenter() maven { url 'https://jitpack.io' } maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda' } + maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-dev/' } maven { url 'https://repo.gradle.org/gradle/libs-releases' } } diff --git a/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-master.xml b/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-master.xml new file mode 100644 index 00000000..5ea2e5fd --- /dev/null +++ b/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-master.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-v1.xml b/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-v1.xml new file mode 100644 index 00000000..f8604243 --- /dev/null +++ b/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-v1.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-v2.xml b/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-v2.xml new file mode 100644 index 00000000..f1317ed5 --- /dev/null +++ b/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-v2.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-master.xml b/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-master.xml new file mode 100644 index 00000000..5ea2e5fd --- /dev/null +++ b/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-master.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-v1.xml b/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-v1.xml new file mode 100644 index 00000000..f8604243 --- /dev/null +++ b/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-v1.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-v2.xml b/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-v2.xml new file mode 100644 index 00000000..f1317ed5 --- /dev/null +++ b/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-v2.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/Features/constants.properties b/Features/constants.properties index 0b0f28b2..e2d6b3ba 100644 --- a/Features/constants.properties +++ b/Features/constants.properties @@ -1,7 +1,7 @@ cordaReleaseGroup=net.corda cordaCoreReleaseGroup=net.corda -cordaVersion=4.5-RC02 -cordaCoreVersion=4.5-RC02 +cordaVersion=4.6-20200713_101257-adeea5c +cordaCoreVersion=4.6-20200713_101257-adeea5c gradlePluginsVersion=5.0.10 kotlinVersion=1.2.71 junitVersion=4.12 diff --git a/Features/queryableState-carinsurance/build.gradle b/Features/queryableState-carinsurance/build.gradle index 2bc6c258..e41a17fc 100644 --- a/Features/queryableState-carinsurance/build.gradle +++ b/Features/queryableState-carinsurance/build.gradle @@ -24,6 +24,8 @@ buildscript { mavenCentral() jcenter() maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-releases' } + maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-dev/' } + } dependencies { diff --git a/Features/queryableState-carinsurance/contracts/src/main/kotlin/net/corda/samples/schema/InsuranceSchemaV1.kt b/Features/queryableState-carinsurance/contracts/src/main/kotlin/net/corda/samples/schema/InsuranceSchemaV1.kt index 6f2414d7..44a8d890 100644 --- a/Features/queryableState-carinsurance/contracts/src/main/kotlin/net/corda/samples/schema/InsuranceSchemaV1.kt +++ b/Features/queryableState-carinsurance/contracts/src/main/kotlin/net/corda/samples/schema/InsuranceSchemaV1.kt @@ -19,6 +19,11 @@ object InsuranceSchemaV1 : MappedSchema( version = 1, mappedTypes = listOf(PersistentClaim::class.java, PersistentInsurance::class.java, PersistentVehicle::class.java)) { + + override val migrationResource: String? + get() = "insurance.changelog-master"; + + @Entity @Table(name = "CLAIM_DETAIL") class PersistentClaim( diff --git a/Features/queryableState-carinsurance/repositories.gradle b/Features/queryableState-carinsurance/repositories.gradle index 2874c2ab..f3ec40bb 100644 --- a/Features/queryableState-carinsurance/repositories.gradle +++ b/Features/queryableState-carinsurance/repositories.gradle @@ -3,6 +3,7 @@ repositories { mavenCentral() jcenter() maven { url 'https://jitpack.io' } + maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-dev/' } maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda' } maven { url 'https://repo.gradle.org/gradle/libs-releases' } } diff --git a/Features/queryableState-carinsurance/workflows/src/main/resources/migration/claim-detail.changelog-v1.xml b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/claim-detail.changelog-v1.xml new file mode 100644 index 00000000..75f55f53 --- /dev/null +++ b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/claim-detail.changelog-v1.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Features/queryableState-carinsurance/workflows/src/main/resources/migration/insurance-detail.changelog-v1.xml b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/insurance-detail.changelog-v1.xml new file mode 100644 index 00000000..c25d03c3 --- /dev/null +++ b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/insurance-detail.changelog-v1.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Features/queryableState-carinsurance/workflows/src/main/resources/migration/insurance.changelog-master.xml b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/insurance.changelog-master.xml new file mode 100644 index 00000000..c743c316 --- /dev/null +++ b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/insurance.changelog-master.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/Features/queryableState-carinsurance/workflows/src/main/resources/migration/vehicle-detail.changelog-v1.xml b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/vehicle-detail.changelog-v1.xml new file mode 100644 index 00000000..3023e5e4 --- /dev/null +++ b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/vehicle-detail.changelog-v1.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file From f007925427b1b719670b98ca5a9870e195eb8351 Mon Sep 17 00:00:00 2001 From: snehadamle Date: Thu, 30 Jul 2020 18:39:51 +0530 Subject: [PATCH 2/5] ENT-5267 Adding @Type (type = "uuid-char") for uuid type --- .../src/main/java/com/example/schema/IOUSchemaV1.java | 3 ++- .../src/main/kotlin/com/example/schema/IOUSchema.kt | 2 ++ .../main/kotlin/net/corda/samples/schema/InsuranceSchemaV1.kt | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Basic/cordapp-example/contracts-java/src/main/java/com/example/schema/IOUSchemaV1.java b/Basic/cordapp-example/contracts-java/src/main/java/com/example/schema/IOUSchemaV1.java index 1263a018..83a2cb28 100644 --- a/Basic/cordapp-example/contracts-java/src/main/java/com/example/schema/IOUSchemaV1.java +++ b/Basic/cordapp-example/contracts-java/src/main/java/com/example/schema/IOUSchemaV1.java @@ -9,6 +9,7 @@ import javax.persistence.Table; import java.util.Arrays; import java.util.UUID; +import org.hibernate.annotations.Type; /** * An IOUState schema. @@ -31,7 +32,7 @@ public static class PersistentIOU extends PersistentState { @Column(name = "lender") private final String lender; @Column(name = "borrower") private final String borrower; @Column(name = "value") private final int value; - @Column(name = "linear_id") private final UUID linearId; + @Column(name = "linear_id") @Type (type = "uuid-char") private final UUID linearId; public PersistentIOU(String lender, String borrower, int value, UUID linearId) { diff --git a/Basic/cordapp-example/contracts-kotlin/src/main/kotlin/com/example/schema/IOUSchema.kt b/Basic/cordapp-example/contracts-kotlin/src/main/kotlin/com/example/schema/IOUSchema.kt index 4edb2637..51f958b3 100644 --- a/Basic/cordapp-example/contracts-kotlin/src/main/kotlin/com/example/schema/IOUSchema.kt +++ b/Basic/cordapp-example/contracts-kotlin/src/main/kotlin/com/example/schema/IOUSchema.kt @@ -2,6 +2,7 @@ package com.example.schema import net.corda.core.schemas.MappedSchema import net.corda.core.schemas.PersistentState +import org.hibernate.annotations.Type import java.util.* import javax.persistence.Column import javax.persistence.Entity @@ -37,6 +38,7 @@ object IOUSchemaV1 : MappedSchema( var value: Int, @Column(name = "linear_id") + @Type(type = "uuid-char") var linearId: UUID ) : PersistentState() { // Default constructor required by hibernate. diff --git a/Features/queryableState-carinsurance/contracts/src/main/kotlin/net/corda/samples/schema/InsuranceSchemaV1.kt b/Features/queryableState-carinsurance/contracts/src/main/kotlin/net/corda/samples/schema/InsuranceSchemaV1.kt index 44a8d890..b27c8611 100644 --- a/Features/queryableState-carinsurance/contracts/src/main/kotlin/net/corda/samples/schema/InsuranceSchemaV1.kt +++ b/Features/queryableState-carinsurance/contracts/src/main/kotlin/net/corda/samples/schema/InsuranceSchemaV1.kt @@ -2,6 +2,7 @@ package net.corda.samples.schema import net.corda.core.schemas.MappedSchema import net.corda.core.schemas.PersistentState +import org.hibernate.annotations.Type import java.io.Serializable import java.util.* import javax.persistence.* @@ -28,6 +29,7 @@ object InsuranceSchemaV1 : MappedSchema( @Table(name = "CLAIM_DETAIL") class PersistentClaim( @Id @Column(name = "Id") + @Type(type = "uuid-char") val uuid:UUID, @Column(name = "claimNumber") @@ -47,6 +49,7 @@ object InsuranceSchemaV1 : MappedSchema( @Table(name = "VEHICLE_DETAIL") class PersistentVehicle( @Id @Column(name = "Id") + @Type (type = "uuid-char") val uuid:UUID, @Column(name = "registrationNumber") From cec59ac7fe8f1ebb96c457b4338a1b1d08597834 Mon Sep 17 00:00:00 2001 From: snehadamle Date: Thu, 30 Jul 2020 19:39:35 +0530 Subject: [PATCH 3/5] making uuid datatype to NVARCHAR(64) in liquibase script --- .../main/resources/migration/iou.changelog-v1.xml | 2 +- .../main/resources/migration/iou.changelog-v2.xml | 14 -------------- .../main/resources/migration/iou.changelog-v1.xml | 2 +- .../main/resources/migration/iou.changelog-v2.xml | 14 -------------- 4 files changed, 2 insertions(+), 30 deletions(-) delete mode 100644 Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-v2.xml delete mode 100644 Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-v2.xml diff --git a/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-v1.xml b/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-v1.xml index f8604243..fb9b580d 100644 --- a/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-v1.xml +++ b/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-v1.xml @@ -14,7 +14,7 @@ - + \ No newline at end of file diff --git a/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-v2.xml b/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-v2.xml deleted file mode 100644 index f1317ed5..00000000 --- a/Basic/cordapp-example/workflows-java/src/main/resources/migration/iou.changelog-v2.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - diff --git a/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-v1.xml b/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-v1.xml index f8604243..fb9b580d 100644 --- a/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-v1.xml +++ b/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-v1.xml @@ -14,7 +14,7 @@ - + \ No newline at end of file diff --git a/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-v2.xml b/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-v2.xml deleted file mode 100644 index f1317ed5..00000000 --- a/Basic/cordapp-example/workflows-kotlin/src/main/resources/migration/iou.changelog-v2.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - From 7e0a29a2eded02f4b95e86ba80cb4db75d32b4e6 Mon Sep 17 00:00:00 2001 From: snehadamle Date: Thu, 30 Jul 2020 19:53:58 +0530 Subject: [PATCH 4/5] change datatype from uuid to varchar in liquibase script --- .../src/main/resources/migration/claim-detail.changelog-v1.xml | 2 +- .../main/resources/migration/insurance-detail.changelog-v1.xml | 2 +- .../main/resources/migration/vehicle-detail.changelog-v1.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Features/queryableState-carinsurance/workflows/src/main/resources/migration/claim-detail.changelog-v1.xml b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/claim-detail.changelog-v1.xml index 75f55f53..cb08c3e0 100644 --- a/Features/queryableState-carinsurance/workflows/src/main/resources/migration/claim-detail.changelog-v1.xml +++ b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/claim-detail.changelog-v1.xml @@ -14,7 +14,7 @@ - + diff --git a/Features/queryableState-carinsurance/workflows/src/main/resources/migration/insurance-detail.changelog-v1.xml b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/insurance-detail.changelog-v1.xml index c25d03c3..be89e59b 100644 --- a/Features/queryableState-carinsurance/workflows/src/main/resources/migration/insurance-detail.changelog-v1.xml +++ b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/insurance-detail.changelog-v1.xml @@ -15,7 +15,7 @@ - + diff --git a/Features/queryableState-carinsurance/workflows/src/main/resources/migration/vehicle-detail.changelog-v1.xml b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/vehicle-detail.changelog-v1.xml index 3023e5e4..101fe505 100644 --- a/Features/queryableState-carinsurance/workflows/src/main/resources/migration/vehicle-detail.changelog-v1.xml +++ b/Features/queryableState-carinsurance/workflows/src/main/resources/migration/vehicle-detail.changelog-v1.xml @@ -6,7 +6,7 @@ - + From 3f3609b6cdd99adc89e60606202b1fae1c691e06 Mon Sep 17 00:00:00 2001 From: snehadamle Date: Thu, 30 Jul 2020 20:08:23 +0530 Subject: [PATCH 5/5] adding some info to readme --- Basic/cordapp-example/README.md | 29 ++++++++++++++++++- .../queryableState-carinsurance/README.md | 29 ++++++++++++++++++- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/Basic/cordapp-example/README.md b/Basic/cordapp-example/README.md index 642ccc14..76de0269 100644 --- a/Basic/cordapp-example/README.md +++ b/Basic/cordapp-example/README.md @@ -6,4 +6,31 @@ Welcome to the example CorDapp. This CorDapp is fully documented [here](http://docs.corda.net/tutorial-cordapp.html). -This example application has modules for both Java and Kotlin and is an exploratory sample for the official [Corda online training](https://training.corda.net). It demonstrates the basic components present in a CorDapp and how they work together using a simple IOU example. \ No newline at end of file +This example application has modules for both Java and Kotlin and is an exploratory sample for the official [Corda online training](https://training.corda.net). It demonstrates the basic components present in a CorDapp and how they work together using a simple IOU example. + +Additional Notes: + +With Corda release 4.6, open source cordapps will have to write liquibase scripts to generate the custom database tables. +For rapid development in dev mode with H2, you could use below command to generate Hibernate entities for your custom schemas. You will not +require Liquibase scripts in such a situation. + + java -jar corda.jar run-migration-scripts --app-schemas + +Liquibase scripts have been added to workflow-java/src/main/resojurces/migration folder. + +To run the migration scripts for corda node use below command + + java -jar corda.jar run-migration-scripts --core-schemas + + +To run the migration scripts for your custom tables defined in your Cordapp use below command + + java -jar corda.jar run-migration-scripts --app-schemas + +If you already have hibernate entities created in your db, prior to using Corda version 4.6, use below command to sync the database + + java -jar corda.jar sync-app-schemas + + +Read more about hwo to add liquibase to your cordapp here. +# TODO update documentation link. diff --git a/Features/queryableState-carinsurance/README.md b/Features/queryableState-carinsurance/README.md index 843cc7ec..1a5912a0 100644 --- a/Features/queryableState-carinsurance/README.md +++ b/Features/queryableState-carinsurance/README.md @@ -71,4 +71,31 @@ http://www.h2database.com/html/download.html

Refer here for more details regarding connecting to the node database. -https://docs.corda.net/head/node-database-access-h2.html \ No newline at end of file +https://docs.corda.net/head/node-database-access-h2.html + +Additional Notes: + +With Corda release 4.6, open source cordapps will have to write liquibase scripts to generate the custom database tables. +For rapid development in dev mode with H2, you could use below command to generate Hibernate entities for your custom schemas. You will not +require Liquibase scripts in such a situation. + + java -jar corda.jar run-migration-scripts --app-schemas + +Liquibase scripts have been added to workflow-java/src/main/resojurces/migration folder. + +To run the migration scripts for corda node use below command + + java -jar corda.jar run-migration-scripts --core-schemas + + +To run the migration scripts for your custom tables defined in your Cordapp use below command + + java -jar corda.jar run-migration-scripts --app-schemas + +If you already have hibernate entities created in your db, prior to using Corda version 4.6, use below command to sync the database + + java -jar corda.jar sync-app-schemas + + +Read more about hwo to add liquibase to your cordapp here. +# TODO update documentation link.