Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ent 5267 #13

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Basic/constants.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions Basic/cordapp-example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
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;
import java.util.Arrays;
import java.util.UUID;
import org.hibernate.annotations.Type;

/**
* An IOUState schema.
Expand All @@ -17,13 +19,20 @@ 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 {
@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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -19,6 +20,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(
Expand All @@ -32,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.
Expand Down
1 change: 1 addition & 0 deletions Basic/cordapp-example/repositories.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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">

<include file="migration/iou.changelog-v1.xml"/>
</databaseChangeLog>
Comment on lines +7 to +8
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have changelog v1 and v2, but only including v1 here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry i will remove v2. I had added that to test database upgrades.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?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="create_iou_state">
<createTable tableName="iou_states">
<column name="output_index" type="INT">
<constraints nullable="false"/>
</column>
<column name="transaction_id" type="NVARCHAR(64)">
<constraints nullable="false"/>
</column>
<column name="value" type="int"/>
<column name="lender" type="NVARCHAR(64)"/>
<column name="borrower" type="NVARCHAR(64)"/>
<column name="linear_id" type="uuid"/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this needs to beof type VARCHAR(64) when using uuid-char in the type annotation.

</createTable>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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.Corda1" id="add_iou_state_column">
<addColumn tableName="iou_states">
<column name="constraint_type" type="INT" defaultValue="0">
<constraints nullable="false"/>
</column>
</addColumn>
</changeSet>
</databaseChangeLog>

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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">

<include file="migration/iou.changelog-v1.xml"/>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?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="create_iou_state">
<createTable tableName="iou_states">
<column name="output_index" type="INT">
<constraints nullable="false"/>
</column>
<column name="transaction_id" type="NVARCHAR(64)">
<constraints nullable="false"/>
</column>
<column name="value" type="int"/>
<column name="lender" type="NVARCHAR(64)"/>
<column name="borrower" type="NVARCHAR(64)"/>
<column name="linear_id" type="uuid"/>
</createTable>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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.Corda1" id="add_iou_state_column">
<addColumn tableName="iou_states">
<column name="constraint_type" type="INT" defaultValue="0">
<constraints nullable="false"/>
</column>
</addColumn>
</changeSet>
</databaseChangeLog>

4 changes: 2 additions & 2 deletions Features/constants.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions Features/queryableState-carinsurance/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand All @@ -19,10 +20,16 @@ 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(
@Id @Column(name = "Id")
@Type(type = "uuid-char")
val uuid:UUID,

@Column(name = "claimNumber")
Expand All @@ -42,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")
Expand Down
1 change: 1 addition & 0 deletions Features/queryableState-carinsurance/repositories.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?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="create_claim_detail_state">
<createTable tableName="claim_detail">
<column name="output_index" type="INT">
<constraints nullable="false"/>
</column>
<column name="transaction_id" type="NVARCHAR(64)">
<constraints nullable="false"/>
</column>
<column name="claimAmount" type="int"/>
<column name="claimNumber" type="NVARCHAR(64)"/>
<column name="claimDescription" type="NVARCHAR(64)"/>
<column name="id" type="uuid"/>

</createTable>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?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="create_insurance_detail_state">
<createTable tableName="insurance_detail">
<column name="output_index" type="INT">
<constraints nullable="false"/>
</column>
<column name="transaction_id" type="NVARCHAR(64)">
<constraints nullable="false"/>
</column>
<column name="policyNumber" type="NVARCHAR(64)"/>
<column name="duration" type="int"/>
<column name="premium" type="int"/>
<column name="insuredvalue" type="BIGINT"/>
<column name="id" type="uuid"/>
<column name="registrationnumber" type="NVARCHAR(64)"/>

</createTable>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?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">

<include file="migration/claim-detail.changelog-v1.xml"/>
<include file="migration/insurance-detail.changelog-v1.xml"/>
<include file="migration/vehicle-detail.changelog-v1.xml"/>

</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?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="create_vehicle_detail_state">
<createTable tableName="vehicle_detail">

<column name="id" type="uuid"/>
<column name="registrationNumber" type="NVARCHAR(64)"/>
<column name="chasisNumber" type="NVARCHAR(64)"/>
<column name="make" type="NVARCHAR(64)"/>
<column name="model" type="NVARCHAR(64)"/>
<column name="variant" type="NVARCHAR(64)"/>
<column name="color" type="NVARCHAR(64)"/>
<column name="fuelType" type="NVARCHAR(64)"/>

</createTable>
</changeSet>
</databaseChangeLog>