Skip to content

Commit 2e2409e

Browse files
committed
upgrade Basic samples
1 parent a7ba802 commit 2e2409e

File tree

16 files changed

+98
-9
lines changed

16 files changed

+98
-9
lines changed

Basic/constants.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
cordaReleaseGroup=net.corda
22
cordaCoreReleaseGroup=net.corda
3-
cordaVersion=4.5
4-
cordaCoreVersion=4.5
5-
gradlePluginsVersion=5.0.10
3+
cordaVersion=4.6
4+
cordaCoreVersion=4.6
5+
gradlePluginsVersion=5.0.12
66
kotlinVersion=1.2.71
77
junitVersion=4.12
88
quasarVersion=0.7.10
99
log4jVersion =2.11.2
10-
platformVersion=5
10+
platformVersion=8
1111
slf4jVersion=1.7.25
1212
nettyVersion=4.1.22.Final

Basic/cordapp-example/.idea/workspace.xml

Lines changed: 18 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Basic/cordapp-example/contracts-java/src/main/java/com/example/schema/IOUSchemaV1.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
import javax.persistence.Table;
99
import java.util.Arrays;
1010
import java.util.UUID;
11+
//4.6 changes
12+
import org.hibernate.annotations.Type;
13+
import javax.annotation.Nullable;
1114

1215
/**
1316
* An IOUState schema.
@@ -17,13 +20,19 @@ public IOUSchemaV1() {
1720
super(IOUSchema.class, 1, Arrays.asList(PersistentIOU.class));
1821
}
1922

23+
@Nullable
24+
@Override
25+
public String getMigrationResource() {
26+
return "iou.changelog-master";
27+
}
28+
2029
@Entity
2130
@Table(name = "iou_states")
2231
public static class PersistentIOU extends PersistentState {
2332
@Column(name = "lender") private final String lender;
2433
@Column(name = "borrower") private final String borrower;
2534
@Column(name = "value") private final int value;
26-
@Column(name = "linear_id") private final UUID linearId;
35+
@Column(name = "linear_id") @Type (type = "uuid-char") private final UUID linearId;
2736

2837

2938
public PersistentIOU(String lender, String borrower, int value, UUID linearId) {

Basic/cordapp-example/contracts-kotlin/src/main/kotlin/com/example/schema/IOUSchema.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import java.util.*
66
import javax.persistence.Column
77
import javax.persistence.Entity
88
import javax.persistence.Table
9-
9+
//4.6 changes
10+
import org.hibernate.annotations.Type
1011
/**
1112
* The family of schemas for IOUState.
1213
*/
@@ -19,6 +20,10 @@ object IOUSchemaV1 : MappedSchema(
1920
schemaFamily = IOUSchema.javaClass,
2021
version = 1,
2122
mappedTypes = listOf(PersistentIOU::class.java)) {
23+
24+
override val migrationResource: String?
25+
get() = "iou.changelog-master";
26+
2227
@Entity
2328
@Table(name = "iou_states")
2429
class PersistentIOU(
@@ -32,6 +37,7 @@ object IOUSchemaV1 : MappedSchema(
3237
var value: Int,
3338

3439
@Column(name = "linear_id")
40+
@Type(type = "uuid-char")
3541
var linearId: UUID
3642
) : PersistentState() {
3743
// Default constructor required by hibernate.

Basic/cordapp-example/workflows-java/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ task integrationTest(type: Test, dependsOn: []) {
7070
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
7171
nodeDefaults {
7272
cordapp project(":contracts-java")
73+
runSchemaMigration = true
7374
}
7475
node {
7576
name "O=Notary,L=London,C=GB"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
2+
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
3+
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
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">
6+
7+
<include file="migration/iou.changelog-v1.xml"/>
8+
</databaseChangeLog>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
2+
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
3+
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
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">
6+
<changeSet author="R3.Corda" id="create_iou_state">
7+
<createTable tableName="iou_states">
8+
<column name="output_index" type="INT"/>
9+
<column name="transaction_id" type="NVARCHAR(64)"/>
10+
<column name="value" type="int"/>
11+
<column name="lender" type="NVARCHAR(64)"/>
12+
<column name="borrower" type="NVARCHAR(64)"/>
13+
<column name="linear_id" type="NVARCHAR(64)"/>
14+
</createTable>
15+
</changeSet>
16+
</databaseChangeLog>

Basic/cordapp-example/workflows-kotlin/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
7171
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
7272
nodeDefaults {
7373
cordapp project(":contracts-kotlin")
74+
runSchemaMigration = true
7475
}
7576
node {
7677
name "O=Notary,L=London,C=GB"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
2+
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
3+
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
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">
6+
7+
<include file="migration/iou.changelog-v1.xml"/>
8+
</databaseChangeLog>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
2+
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
3+
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
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">
6+
<changeSet author="R3.Corda" id="create_iou_state">
7+
<createTable tableName="iou_states">
8+
<column name="output_index" type="INT"/>
9+
<column name="transaction_id" type="NVARCHAR(64)"/>
10+
<column name="value" type="int"/>
11+
<column name="lender" type="NVARCHAR(64)"/>
12+
<column name="borrower" type="NVARCHAR(64)"/>
13+
<column name="linear_id" type="NVARCHAR(64)"/>
14+
</createTable>
15+
</changeSet>
16+
</databaseChangeLog>

0 commit comments

Comments
 (0)