mirror of
https://github.com/corda/corda.git
synced 2024-12-27 08:22:35 +00:00
* [ENT-1339]: for h2, allow schemas without migrations to run (#294) * [ENT-1339]: for h2, allow schemas without migrations to run * [ENT-1339]: fix various migration issues and change author name * [ENT-1339]: add naming convention for migrations * [ENT-1339]: change naming convention to use hyphens * [ENT-1339]: change mapping of participants to be able to control the table name * [ENT-1339]: change FK names to <=30 for oracle 11g compatibility * [ENT-1339]: cmd line argument for migrations made consistent * [ENT-1339]: revert abstract state superclasses * Update db integration test setup - new tables. * Update db integration test setup - new tables. * [ENT-1339]: remove final from participants to allow table name config * [ENT-1339]: shortened pk * [ENT-1339]: revert constructor * [ENT-1339]: change getMigrationResource api to Nullable
This commit is contained in:
parent
a65db712c7
commit
0c646ff662
@ -2654,12 +2654,12 @@ public final class net.corda.core.schemas.CommonSchemaV1 extends net.corda.core.
|
||||
@org.jetbrains.annotations.NotNull public final net.corda.core.identity.AbstractParty getIssuer()
|
||||
@org.jetbrains.annotations.NotNull public final byte[] getIssuerRef()
|
||||
@org.jetbrains.annotations.NotNull public final net.corda.core.identity.AbstractParty getOwner()
|
||||
@org.jetbrains.annotations.Nullable public final Set getParticipants()
|
||||
@org.jetbrains.annotations.Nullable public Set getParticipants()
|
||||
public final long getQuantity()
|
||||
public final void setIssuer(net.corda.core.identity.AbstractParty)
|
||||
public final void setIssuerRef(byte[])
|
||||
public final void setOwner(net.corda.core.identity.AbstractParty)
|
||||
public final void setParticipants(Set)
|
||||
public void setParticipants(Set)
|
||||
public final void setQuantity(long)
|
||||
##
|
||||
@javax.persistence.MappedSuperclass @net.corda.core.serialization.CordaSerializable public static class net.corda.core.schemas.CommonSchemaV1$LinearState extends net.corda.core.schemas.PersistentState
|
||||
@ -2667,10 +2667,10 @@ public final class net.corda.core.schemas.CommonSchemaV1 extends net.corda.core.
|
||||
public <init>(Set, String, UUID)
|
||||
public <init>(net.corda.core.contracts.UniqueIdentifier, Set)
|
||||
@org.jetbrains.annotations.Nullable public final String getExternalId()
|
||||
@org.jetbrains.annotations.Nullable public final Set getParticipants()
|
||||
@org.jetbrains.annotations.Nullable public Set getParticipants()
|
||||
@org.jetbrains.annotations.NotNull public final UUID getUuid()
|
||||
public final void setExternalId(String)
|
||||
public final void setParticipants(Set)
|
||||
public void setParticipants(Set)
|
||||
public final void setUuid(UUID)
|
||||
##
|
||||
public class net.corda.core.schemas.MappedSchema extends java.lang.Object
|
||||
@ -2703,7 +2703,7 @@ public class net.corda.core.schemas.MappedSchema extends java.lang.Object
|
||||
public String toString()
|
||||
##
|
||||
public final class net.corda.core.schemas.PersistentTypesKt extends java.lang.Object
|
||||
@org.jetbrains.annotations.NotNull public static final String getMigrationResource(net.corda.core.schemas.MappedSchema)
|
||||
@org.jetbrains.annotations.Nullable public static final String getMigrationResource(net.corda.core.schemas.MappedSchema)
|
||||
##
|
||||
@net.corda.core.serialization.CordaSerializable public interface net.corda.core.schemas.QueryableState extends net.corda.core.contracts.ContractState
|
||||
@org.jetbrains.annotations.NotNull public abstract net.corda.core.schemas.PersistentState generateMappedObject(net.corda.core.schemas.MappedSchema)
|
||||
|
@ -35,14 +35,14 @@ object NodeInfoSchemaV1 : MappedSchema(
|
||||
|
||||
@Column(name = "addresses")
|
||||
@OneToMany(cascade = arrayOf(CascadeType.ALL), orphanRemoval = true)
|
||||
@JoinColumn(name = "node_info_id")
|
||||
@JoinColumn(name = "node_info_id", foreignKey = ForeignKey(name = "FK__info_hosts__infos"))
|
||||
val addresses: List<NodeInfoSchemaV1.DBHostAndPort>,
|
||||
|
||||
@Column(name = "legal_identities_certs")
|
||||
@ManyToMany(cascade = arrayOf(CascadeType.ALL))
|
||||
@JoinTable(name = "node_link_nodeinfo_party",
|
||||
joinColumns = arrayOf(JoinColumn(name = "node_info_id")),
|
||||
inverseJoinColumns = arrayOf(JoinColumn(name = "party_name")))
|
||||
joinColumns = arrayOf(JoinColumn(name = "node_info_id", foreignKey = ForeignKey(name = "FK__link_nodeinfo_party__infos"))),
|
||||
inverseJoinColumns = arrayOf(JoinColumn(name = "party_name", foreignKey = ForeignKey(name = "FK__link_ni_p__info_p_cert"))))
|
||||
val legalIdentitiesAndCerts: List<DBPartyAndCertificate>,
|
||||
|
||||
@Column(name = "platform_version")
|
||||
|
@ -23,12 +23,8 @@ object CommonSchemaV1 : MappedSchema(schemaFamily = CommonSchema.javaClass, vers
|
||||
/** [ContractState] attributes */
|
||||
|
||||
/** X500Name of participant parties **/
|
||||
@ElementCollection
|
||||
@Column(name = "participants")
|
||||
@CollectionTable(name="state_participants",joinColumns = arrayOf(
|
||||
JoinColumn(name = "output_index", referencedColumnName = "output_index"),
|
||||
JoinColumn(name = "transaction_id", referencedColumnName = "transaction_id")))
|
||||
var participants: MutableSet<AbstractParty>? = null,
|
||||
@Transient
|
||||
open var participants: MutableSet<AbstractParty>? = null,
|
||||
|
||||
/**
|
||||
* Represents a [LinearState] [UniqueIdentifier]
|
||||
@ -52,12 +48,8 @@ object CommonSchemaV1 : MappedSchema(schemaFamily = CommonSchema.javaClass, vers
|
||||
/** [ContractState] attributes */
|
||||
|
||||
/** X500Name of participant parties **/
|
||||
@ElementCollection
|
||||
@Column(name = "participants")
|
||||
@CollectionTable(name="state_participants",joinColumns = arrayOf(
|
||||
JoinColumn(name = "output_index", referencedColumnName = "output_index"),
|
||||
JoinColumn(name = "transaction_id", referencedColumnName = "transaction_id")))
|
||||
var participants: MutableSet<AbstractParty>? = null,
|
||||
@Transient
|
||||
open var participants: MutableSet<AbstractParty>? = null,
|
||||
|
||||
/** [OwnableState] attributes */
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.corda.core.schemas
|
||||
|
||||
import com.google.common.base.CaseFormat
|
||||
import net.corda.core.contracts.ContractState
|
||||
import net.corda.core.contracts.StateRef
|
||||
import net.corda.core.serialization.CordaSerializable
|
||||
@ -47,7 +48,7 @@ open class MappedSchema(schemaFamily: Class<*>,
|
||||
*/
|
||||
protected open val migrationResource: String? = null
|
||||
|
||||
internal fun getMigrationResource(): String = migrationResource ?: throw IllegalStateException("Migration resource not set for schema $this")
|
||||
internal fun getMigrationResource(): String? = migrationResource
|
||||
|
||||
override fun toString(): String = "${this.javaClass.simpleName}(name=$name, version=$version)"
|
||||
}
|
||||
@ -79,4 +80,24 @@ data class PersistentStateRef(
|
||||
*/
|
||||
interface StatePersistable
|
||||
|
||||
fun getMigrationResource(schema: MappedSchema): String = schema.getMigrationResource()
|
||||
private const val MIGRATION_PREFIX = "migration"
|
||||
private val possibleMigrationExtensions = listOf(".xml", ".sql", ".yml", ".json")
|
||||
fun getMigrationResource(schema: MappedSchema): String? {
|
||||
|
||||
val declaredMigration = schema.getMigrationResource()
|
||||
|
||||
if (declaredMigration == null) {
|
||||
// try to apply a naming convention
|
||||
// SchemaName will be transformed from camel case to hyphen
|
||||
// then ".changelog-master" plus one of the supported extensions will be added
|
||||
val name: String = schema::class.simpleName!!
|
||||
val fileName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, name)
|
||||
val resource = "${MIGRATION_PREFIX}/${fileName}.changelog-master"
|
||||
val foundResource = possibleMigrationExtensions.map { "${resource}${it}" }.firstOrNull {
|
||||
Thread.currentThread().contextClassLoader.getResource(it) != null
|
||||
}
|
||||
return foundResource
|
||||
} else {
|
||||
return "${MIGRATION_PREFIX}/${declaredMigration}.xml"
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
create table contract_cash_states (
|
||||
output_index int4 not null,
|
||||
transaction_id varchar(64) not null,
|
||||
ccy_code varchar(3),
|
||||
issuer_key_hash varchar(130),
|
||||
issuer_ref bytea,
|
||||
owner_name varchar(255),
|
||||
pennies int8,
|
||||
primary key (output_index, transaction_id)
|
||||
);
|
||||
|
||||
create index ccy_code_idx on contract_cash_states (ccy_code);
|
||||
create index pennies_idx on contract_cash_states (pennies);
|
||||
|
||||
|
||||
create table cp_states (
|
||||
output_index int4 not null,
|
||||
transaction_id varchar(64) not null,
|
||||
ccy_code varchar(3),
|
||||
face_value int8,
|
||||
face_value_issuer_key_hash varchar(130),
|
||||
face_value_issuer_ref bytea,
|
||||
issuance_key_hash varchar(130),
|
||||
issuance_ref bytea,
|
||||
maturity_instant timestamp,
|
||||
owner_key_hash varchar(130),
|
||||
primary key (output_index, transaction_id)
|
||||
);
|
||||
|
||||
create index ccy_code_index on cp_states (ccy_code);
|
||||
create index maturity_index on cp_states (maturity_instant);
|
||||
create index face_value_index on cp_states (face_value);
|
@ -1,32 +0,0 @@
|
||||
create table contract_cash_states (
|
||||
output_index int not null,
|
||||
transaction_id varchar(64) not null,
|
||||
ccy_code varchar(3),
|
||||
issuer_key_hash varchar(130),
|
||||
issuer_ref varbinary(512),
|
||||
owner_name varchar(255),
|
||||
pennies bigint,
|
||||
primary key (output_index, transaction_id)
|
||||
);
|
||||
|
||||
create index ccy_code_idx on contract_cash_states (ccy_code);
|
||||
create index pennies_idx on contract_cash_states (pennies);
|
||||
|
||||
|
||||
create table cp_states (
|
||||
output_index int not null,
|
||||
transaction_id varchar(64) not null,
|
||||
ccy_code varchar(3),
|
||||
face_value bigint,
|
||||
face_value_issuer_key_hash varchar(130),
|
||||
face_value_issuer_ref varbinary(512),
|
||||
issuance_key_hash varchar(130),
|
||||
issuance_ref varbinary(255),
|
||||
maturity_instant datetime2,
|
||||
owner_key_hash varchar(130),
|
||||
primary key (output_index, transaction_id)
|
||||
);
|
||||
|
||||
create index ccy_code_index on cp_states (ccy_code);
|
||||
create index maturity_index on cp_states (maturity_instant);
|
||||
create index face_value_index on cp_states (face_value);
|
@ -1,6 +1,6 @@
|
||||
<?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="tudormalene (generated)" id="1511451595465-2">
|
||||
<changeSet author="R3.Corda" id="1511451595465-2">
|
||||
<createTable tableName="contract_cash_states">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -15,15 +15,15 @@
|
||||
<column name="pennies" type="BIGINT"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-28">
|
||||
<changeSet author="R3.Corda" id="1511451595465-28">
|
||||
<addPrimaryKey columnNames="output_index, transaction_id" constraintName="contract_cash_states_pkey" tableName="contract_cash_states"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-51">
|
||||
<changeSet author="R3.Corda" id="1511451595465-51">
|
||||
<createIndex indexName="ccy_code_idx" tableName="contract_cash_states">
|
||||
<column name="ccy_code"/>
|
||||
</createIndex>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-57">
|
||||
<changeSet author="R3.Corda" id="1511451595465-57">
|
||||
<createIndex indexName="pennies_idx" tableName="contract_cash_states">
|
||||
<column name="pennies"/>
|
||||
</createIndex>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?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="tudormalene (generated)" id="1511451595465-3">
|
||||
<changeSet author="R3.Corda" id="1511451595465-3">
|
||||
<createTable tableName="cp_states">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -18,20 +18,20 @@
|
||||
<column name="owner_key_hash" type="NVARCHAR(130)"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-29">
|
||||
<changeSet author="R3.Corda" id="1511451595465-29">
|
||||
<addPrimaryKey columnNames="output_index, transaction_id" constraintName="cp_states_pkey" tableName="cp_states"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-52">
|
||||
<changeSet author="R3.Corda" id="1511451595465-52">
|
||||
<createIndex indexName="ccy_code_index" tableName="cp_states">
|
||||
<column name="ccy_code"/>
|
||||
</createIndex>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-54">
|
||||
<changeSet author="R3.Corda" id="1511451595465-54">
|
||||
<createIndex indexName="face_value_index" tableName="cp_states">
|
||||
<column name="face_value"/>
|
||||
</createIndex>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-56">
|
||||
<changeSet author="R3.Corda" id="1511451595465-56">
|
||||
<createIndex indexName="maturity_index" tableName="cp_states">
|
||||
<column name="maturity_instant"/>
|
||||
</createIndex>
|
||||
|
@ -4,10 +4,7 @@ import net.corda.core.identity.AbstractParty
|
||||
import net.corda.core.schemas.CommonSchemaV1
|
||||
import net.corda.core.schemas.MappedSchema
|
||||
import net.corda.core.utilities.OpaqueBytes
|
||||
import javax.persistence.Column
|
||||
import javax.persistence.Entity
|
||||
import javax.persistence.Index
|
||||
import javax.persistence.Table
|
||||
import javax.persistence.*
|
||||
|
||||
/**
|
||||
* Second version of a cash contract ORM schema that extends the common
|
||||
@ -22,6 +19,14 @@ object SampleCashSchemaV2 : MappedSchema(schemaFamily = CashSchema.javaClass, ve
|
||||
@Table(name = "cash_states_v2",
|
||||
indexes = arrayOf(Index(name = "ccy_code_idx2", columnList = "ccy_code")))
|
||||
class PersistentCashState(
|
||||
|
||||
@ElementCollection
|
||||
@Column(name = "participants")
|
||||
@CollectionTable(name="cash_states_v2_participants", joinColumns = arrayOf(
|
||||
JoinColumn(name = "output_index", referencedColumnName = "output_index"),
|
||||
JoinColumn(name = "transaction_id", referencedColumnName = "transaction_id")))
|
||||
override var participants: MutableSet<AbstractParty>? = null,
|
||||
|
||||
/** product type */
|
||||
@Column(name = "ccy_code", length = 3)
|
||||
var currency: String,
|
||||
|
@ -23,7 +23,7 @@ object SampleCashSchemaV3 : MappedSchema(schemaFamily = CashSchema.javaClass, ve
|
||||
|
||||
/** X500Name of participant parties **/
|
||||
@ElementCollection
|
||||
@CollectionTable(name="state_participants", joinColumns = arrayOf(
|
||||
@CollectionTable(name="cash_state_participants", joinColumns = arrayOf(
|
||||
JoinColumn(name = "output_index", referencedColumnName = "output_index"),
|
||||
JoinColumn(name = "transaction_id", referencedColumnName = "transaction_id")))
|
||||
var participants: MutableSet<AbstractParty>? = null,
|
||||
|
@ -8,10 +8,7 @@ import net.corda.core.utilities.MAX_HASH_HEX_SIZE
|
||||
import net.corda.core.utilities.OpaqueBytes
|
||||
import org.hibernate.annotations.Type
|
||||
import java.time.Instant
|
||||
import javax.persistence.Column
|
||||
import javax.persistence.Entity
|
||||
import javax.persistence.Index
|
||||
import javax.persistence.Table
|
||||
import javax.persistence.*
|
||||
|
||||
/**
|
||||
* Second version of a cash contract ORM schema that extends the common
|
||||
@ -27,6 +24,14 @@ object SampleCommercialPaperSchemaV2 : MappedSchema(schemaFamily = CommercialPap
|
||||
indexes = arrayOf(Index(name = "ccy_code_index2", columnList = "ccy_code"),
|
||||
Index(name = "maturity_index2", columnList = "maturity_instant")))
|
||||
class PersistentCommercialPaperState(
|
||||
|
||||
@ElementCollection
|
||||
@Column(name = "participants")
|
||||
@CollectionTable(name="cp_states_v2_participants", joinColumns = arrayOf(
|
||||
JoinColumn(name = "output_index", referencedColumnName = "output_index"),
|
||||
JoinColumn(name = "transaction_id", referencedColumnName = "transaction_id")))
|
||||
override var participants: MutableSet<AbstractParty>? = null,
|
||||
|
||||
@Column(name = "maturity_instant")
|
||||
var maturity: Instant,
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
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="tudormalene (generated)" id="1511451595465-2">
|
||||
<changeSet author="R3.Corda" id="1511451595465-2">
|
||||
<createTable tableName="contract_cash_states_v1">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -18,16 +18,16 @@
|
||||
<column name="pennies" type="BIGINT"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-28">
|
||||
<changeSet author="R3.Corda" id="1511451595465-28">
|
||||
<addPrimaryKey columnNames="output_index, transaction_id" constraintName="contract_cash_states_v1_pkey"
|
||||
tableName="contract_cash_states_v1"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-51">
|
||||
<changeSet author="R3.Corda" id="1511451595465-51">
|
||||
<createIndex indexName="ccy_code_v1_idx" tableName="contract_cash_states_v1">
|
||||
<column name="ccy_code"/>
|
||||
</createIndex>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-57">
|
||||
<changeSet author="R3.Corda" id="1511451595465-57">
|
||||
<createIndex indexName="pennies_v1_idx" tableName="contract_cash_states_v1">
|
||||
<column name="pennies"/>
|
||||
</createIndex>
|
||||
|
@ -4,7 +4,7 @@
|
||||
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="tudormalene (generated)" id="1512743551377-1">
|
||||
<changeSet author="R3.Corda" id="1512743551377-1">
|
||||
<createTable tableName="cash_states_v2">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -26,6 +26,22 @@
|
||||
<column name="ccy_code"/>
|
||||
</createIndex>
|
||||
|
||||
<createTable tableName="cash_states_v2_participants">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="transaction_id" type="NVARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="participants" type="NVARCHAR(255)"/>
|
||||
</createTable>
|
||||
|
||||
<addForeignKeyConstraint baseColumnNames="output_index,transaction_id"
|
||||
baseTableName="cash_states_v2_participants"
|
||||
constraintName="FKg6ab1fhx6aesnmhlo62o4dnrt_"
|
||||
referencedColumnNames="output_index,transaction_id"
|
||||
referencedTableName="cash_states_v2"/>
|
||||
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
|
@ -4,7 +4,7 @@
|
||||
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="tudormalene (generated)" id="1512743551377-2">
|
||||
<changeSet author="R3.Corda" id="1512743551377-2">
|
||||
<createTable tableName="cash_states_v3">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -22,6 +22,16 @@
|
||||
<addPrimaryKey columnNames="output_index, transaction_id" constraintName="CONSTRAINT_DC"
|
||||
tableName="cash_states_v3"/>
|
||||
|
||||
<createTable tableName="cash_state_participants">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="transaction_id" type="NVARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="participants" type="NVARCHAR(255)"/>
|
||||
</createTable>
|
||||
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
|
@ -3,7 +3,7 @@
|
||||
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="tudormalene (generated)" id="1511451595465-3">
|
||||
<changeSet author="R3.Corda" id="1511451595465-3">
|
||||
<createTable tableName="cp_states_v1">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -21,7 +21,7 @@
|
||||
<column name="owner_key_hash" type="NVARCHAR(130)"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-29">
|
||||
<changeSet author="R3.Corda" id="1511451595465-29">
|
||||
<addPrimaryKey columnNames="output_index, transaction_id" constraintName="cp_states_v1_pkey"
|
||||
tableName="cp_states_v1"/>
|
||||
</changeSet>
|
||||
|
@ -3,7 +3,7 @@
|
||||
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="tudormalene (generated)" id="1512743551377-4">
|
||||
<changeSet author="R3.Corda" id="1512743551377-4">
|
||||
<createTable tableName="cp_states_v2">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -28,5 +28,20 @@
|
||||
<column name="ccy_code"/>
|
||||
</createIndex>
|
||||
|
||||
<createTable tableName="cp_states_v2_participants">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="transaction_id" type="NVARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="participants" type="NVARCHAR(255)"/>
|
||||
</createTable>
|
||||
|
||||
<addForeignKeyConstraint baseColumnNames="output_index,transaction_id"
|
||||
baseTableName="cp_states_v2_participants"
|
||||
constraintName="FKg6ab1fhx6aesnmhlo62o4dnrt_1"
|
||||
referencedColumnNames="output_index,transaction_id"
|
||||
referencedTableName="cp_states_v2"/>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
|
@ -39,7 +39,7 @@ fun configureDatabase(dataSourceProperties: Properties,
|
||||
|
||||
val schemas = setOf(NetworkManagementSchemaServices.SchemaV1)
|
||||
if (databaseConfig.runMigration) {
|
||||
SchemaMigration(schemas, dataSource, databaseConfig.schema).runMigration()
|
||||
SchemaMigration(schemas, dataSource, true, databaseConfig.schema).runMigration()
|
||||
}
|
||||
|
||||
return CordaPersistence(dataSource, databaseConfig, schemas, config.dataSourceProperties.getProperty("url", ""), emptyList())
|
||||
|
@ -100,7 +100,7 @@ class CertificateDataEntity(
|
||||
val certificatePathBytes: ByteArray,
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER, optional = false)
|
||||
@JoinColumn(name = "certificate_signing_request")
|
||||
@JoinColumn(name = "certificate_signing_request", foreignKey = ForeignKey(name = "FK__cert_data__cert_sign_req"))
|
||||
val certificateSigningRequest: CertificateSigningRequestEntity
|
||||
) {
|
||||
fun toCertificateData(): CertificateData {
|
||||
|
@ -1,18 +1,18 @@
|
||||
<?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="tudormalene (generated)" id="1513267683777-1" dbms="mssql">
|
||||
<changeSet author="R3.Corda" id="1513267683777-1" dbms="mssql">
|
||||
<createSequence sequenceName="hibernate_sequence" minValue="1"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-1.2" dbms="azure">
|
||||
<changeSet author="R3.Corda" id="1513267683777-1.2" dbms="azure">
|
||||
<createSequence sequenceName="hibernate_sequence" minValue="1"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-1.2" dbms="postgres">
|
||||
<changeSet author="R3.Corda" id="1513267683777-1.3" dbms="postgres">
|
||||
<createSequence sequenceName="hibernate_sequence" minValue="1"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-1.1" dbms="h2">
|
||||
<changeSet author="R3.Corda" id="1513267683777-1.1" dbms="h2">
|
||||
<createSequence sequenceName="hibernate_sequence"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-2">
|
||||
<changeSet author="R3.Corda" id="1513267683777-2">
|
||||
<createTable tableName="CertificateSigningRequestEntity_modifiedBy">
|
||||
<column name="CertificateSigningRequestEntity_request_id" type="NVARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
@ -20,7 +20,7 @@
|
||||
<column name="modified_by" type="NVARCHAR(512)"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-3">
|
||||
<changeSet author="R3.Corda" id="1513267683777-3">
|
||||
<createTable tableName="CertificateSigningRequestEntity_modifiedBy_AUD">
|
||||
<column name="REV" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -34,7 +34,7 @@
|
||||
<column name="revtype" type="TINYINT"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-4">
|
||||
<changeSet author="R3.Corda" id="1513267683777-4">
|
||||
<createTable tableName="certificate_data">
|
||||
<column name="ID" type="BIGINT">
|
||||
<constraints nullable="false"/>
|
||||
@ -47,7 +47,7 @@
|
||||
</column>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-5">
|
||||
<changeSet author="R3.Corda" id="1513267683777-5">
|
||||
<createTable tableName="certificate_signing_request">
|
||||
<column name="request_id" type="NVARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
@ -67,7 +67,7 @@
|
||||
</column>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-6">
|
||||
<changeSet author="R3.Corda" id="1513267683777-6">
|
||||
<createTable tableName="certificate_signing_request_AUD">
|
||||
<column name="request_id" type="NVARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
@ -81,7 +81,7 @@
|
||||
<column name="status" type="VARCHAR(255)"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-7">
|
||||
<changeSet author="R3.Corda" id="1513267683777-7">
|
||||
<createTable tableName="network_map">
|
||||
<column name="version" type="BIGINT">
|
||||
<constraints nullable="false"/>
|
||||
@ -91,7 +91,7 @@
|
||||
<column name="signature" type="BLOB"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-8">
|
||||
<changeSet author="R3.Corda" id="1513267683777-8">
|
||||
<createTable tableName="network_parameters">
|
||||
<column name="version" type="BIGINT">
|
||||
<constraints nullable="false"/>
|
||||
@ -100,7 +100,7 @@
|
||||
<column name="hash" type="NVARCHAR(64)"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-9">
|
||||
<changeSet author="R3.Corda" id="1513267683777-9">
|
||||
<createTable tableName="node_info">
|
||||
<column name="node_info_hash" type="NVARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
@ -111,7 +111,7 @@
|
||||
</column>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-10">
|
||||
<changeSet author="R3.Corda" id="1513267683777-10">
|
||||
<createTable tableName="REVINFO">
|
||||
<column autoIncrement="true" name="rev" type="INT">
|
||||
<constraints primaryKey="true" primaryKeyName="CONSTRAINT_6"/>
|
||||
@ -119,77 +119,78 @@
|
||||
<column name="revtstmp" type="BIGINT"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-11">
|
||||
<changeSet author="R3.Corda" id="1513267683777-11">
|
||||
<addPrimaryKey columnNames="version" constraintName="CONSTRAINT_3" tableName="network_parameters"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-12">
|
||||
<changeSet author="R3.Corda" id="1513267683777-12">
|
||||
<addPrimaryKey columnNames="id" constraintName="CONSTRAINT_7" tableName="certificate_data"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-13">
|
||||
<changeSet author="R3.Corda" id="1513267683777-13">
|
||||
<addPrimaryKey columnNames="rev, CertificateSigningRequestEntity_request_id, modified_by"
|
||||
constraintName="CONSTRAINT_B" tableName="CertificateSigningRequestEntity_modifiedBy_AUD"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-14">
|
||||
<changeSet author="R3.Corda" id="1513267683777-14">
|
||||
<addPrimaryKey columnNames="request_id, rev" constraintName="CONSTRAINT_C"
|
||||
tableName="certificate_signing_request_AUD"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-15">
|
||||
<changeSet author="R3.Corda" id="1513267683777-15">
|
||||
<addPrimaryKey columnNames="node_info_hash" constraintName="CONSTRAINT_C3" tableName="node_info"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-16">
|
||||
<changeSet author="R3.Corda" id="1513267683777-16">
|
||||
<addPrimaryKey columnNames="version" constraintName="CONSTRAINT_CB" tableName="network_map"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-17">
|
||||
<changeSet author="R3.Corda" id="1513267683777-17">
|
||||
<addPrimaryKey columnNames="request_id" constraintName="CONSTRAINT_D" tableName="certificate_signing_request"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-18">
|
||||
<changeSet author="R3.Corda" id="1513267683777-18">
|
||||
<addUniqueConstraint columnNames="hash" constraintName="UK_3XJ82Q6C0LT4D7XV085CUUX4Q" tableName="network_parameters"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-19">
|
||||
<changeSet author="R3.Corda" id="1513267683777-19">
|
||||
<addUniqueConstraint columnNames="certificate_signing_request" constraintName="UK_4MJ3D7DDYMYV6OA2284VWDFHV" tableName="certificate_data"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-20">
|
||||
<changeSet author="R3.Corda" id="1513267683777-20">
|
||||
<addUniqueConstraint columnNames="certificate_signing_request" constraintName="UK_P37OS0TPLQ2ER2TM9JSDTF1CL" tableName="node_info"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-21">
|
||||
<changeSet author="R3.Corda" id="1513267683777-21">
|
||||
<createIndex indexName="FK5G5CAGCRX7SIU8LWTAVIRUNXD_INDEX_C" tableName="certificate_signing_request_AUD">
|
||||
<column name="rev"/>
|
||||
</createIndex>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-22">
|
||||
<changeSet author="R3.Corda" id="1513267683777-22">
|
||||
<createIndex indexName="FKLFW2KLKDPLYDROVIBVEOMF9PU_INDEX_C"
|
||||
tableName="CertificateSigningRequestEntity_modifiedBy">
|
||||
<column name="CertificateSigningRequestEntity_request_id"/>
|
||||
</createIndex>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-23">
|
||||
<changeSet author="R3.Corda" id="1513267683777-23">
|
||||
<createIndex indexName="IDX_PUB_KEY_HASH" tableName="certificate_data">
|
||||
<column name="public_key_hash"/>
|
||||
</createIndex>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-24">
|
||||
<changeSet author="R3.Corda" id="1513267683777-24">
|
||||
<addForeignKeyConstraint baseColumnNames="rev" baseTableName="certificate_signing_request_AUD"
|
||||
constraintName="FK__certificate_signing_request_AUD__REVINFO" deferrable="false"
|
||||
initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT"
|
||||
constraintName="FK5g5cagcrx7siu8lwtavirunxd"
|
||||
referencedColumnNames="rev" referencedTableName="REVINFO"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-25">
|
||||
<changeSet author="R3.Corda" id="1513267683777-25">
|
||||
<addForeignKeyConstraint baseColumnNames="rev" baseTableName="CertificateSigningRequestEntity_modifiedBy_AUD"
|
||||
constraintName="FK__CertificateSigningRequestEntity_modifiedBy_AUD__REVINFO" deferrable="false"
|
||||
initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT"
|
||||
constraintName="FKcnmaj1j6to8d5gby6n1q3ck9c"
|
||||
referencedColumnNames="rev" referencedTableName="REVINFO"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-26">
|
||||
<addForeignKeyConstraint baseColumnNames="CertificateSigningRequestEntity_request_id"
|
||||
baseTableName="CertificateSigningRequestEntity_modifiedBy"
|
||||
constraintName="FK__CertificateSigningRequestEntity_modifiedBy__certificate_signing_request" deferrable="false"
|
||||
initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT"
|
||||
<changeSet author="R3.Corda" id="1513267683777-26">
|
||||
<addForeignKeyConstraint baseColumnNames="CertificateSigningRequestEntity_request_id" baseTableName="CertificateSigningRequestEntity_modifiedBy"
|
||||
constraintName="FKlfw2klkdplydrovibveomf9pu"
|
||||
referencedColumnNames="request_id" referencedTableName="certificate_signing_request"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-27">
|
||||
<addForeignKeyConstraint baseColumnNames="certificate_signing_request" baseTableName="certificate_data" constraintName="FK__certificate_data__certificate_signing_request" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="request_id" referencedTableName="certificate_signing_request"/>
|
||||
<changeSet author="R3.Corda" id="1513267683777-27">
|
||||
<addForeignKeyConstraint baseColumnNames="certificate_signing_request" baseTableName="certificate_data"
|
||||
constraintName="FK__cert_data__cert_sign_req"
|
||||
referencedColumnNames="request_id" referencedTableName="certificate_signing_request"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1513267683777-28">
|
||||
<addForeignKeyConstraint baseColumnNames="certificate_signing_request" baseTableName="node_info" constraintName="FK__node_info__certificate_signing_request" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="request_id" referencedTableName="certificate_signing_request"/>
|
||||
<changeSet author="R3.Corda" id="add unique constraint on certificate_data">
|
||||
<addUniqueConstraint tableName="certificate_data" columnNames="certificate_signing_request"/>
|
||||
</changeSet>
|
||||
<changeSet author="R3.Corda" id="add unique constraint on node_info">
|
||||
<addUniqueConstraint tableName="node_info" columnNames="certificate_signing_request"/>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
|
@ -229,3 +229,5 @@ fun parserTransactionIsolationLevel(property: String?): Int =
|
||||
Connection.TRANSACTION_REPEATABLE_READ
|
||||
}
|
||||
}
|
||||
|
||||
fun isH2Database(jdbcUrl: String) = jdbcUrl.startsWith("jdbc:h2:")
|
@ -47,7 +47,7 @@ class HibernateConfiguration(
|
||||
val metadataSources = MetadataSources(serviceRegistry)
|
||||
|
||||
val config = Configuration(metadataSources).setProperty("hibernate.connection.provider_class", NodeDatabaseConnectionProvider::class.java.name)
|
||||
.setProperty("hibernate.hbm2ddl.auto", "validate")
|
||||
.setProperty("hibernate.hbm2ddl.auto", if (isH2Database(jdbcUrl)) "update" else "validate")
|
||||
.setProperty("hibernate.connection.isolation", databaseConfig.transactionIsolationLevel.jdbcValue.toString())
|
||||
|
||||
databaseConfig.schema?.apply {
|
||||
@ -86,8 +86,7 @@ class HibernateConfiguration(
|
||||
|
||||
try {
|
||||
mbeanServer.registerMBean(statisticsMBean, statsName)
|
||||
}
|
||||
catch (e: Exception) {
|
||||
} catch (e: Exception) {
|
||||
logger.warn(e.message)
|
||||
}
|
||||
}
|
||||
|
@ -14,9 +14,7 @@ import net.corda.core.utilities.contextLogger
|
||||
import java.io.*
|
||||
import javax.sql.DataSource
|
||||
|
||||
private const val MIGRATION_PREFIX = "migration"
|
||||
|
||||
class SchemaMigration(val schemas: Set<MappedSchema>, val dataSource: DataSource, private val schemaName: String? = null) {
|
||||
class SchemaMigration(val schemas: Set<MappedSchema>, val dataSource: DataSource, val failOnMigrationMissing: Boolean, private val schemaName: String? = null) {
|
||||
|
||||
companion object {
|
||||
private val logger = contextLogger()
|
||||
@ -34,9 +32,16 @@ class SchemaMigration(val schemas: Set<MappedSchema>, val dataSource: DataSource
|
||||
dataSource.connection.use { connection ->
|
||||
|
||||
// collect all changelog file referenced in the included schemas
|
||||
// for backward compatibility reasons, when failOnMigrationMissing=false, we don't manage CorDapps via Liquibase but use the hibernate hbm2ddl=update
|
||||
val changelogList = schemas.map { mappedSchema ->
|
||||
getMigrationResource(mappedSchema).let {
|
||||
"${MIGRATION_PREFIX}/${it}.xml"
|
||||
val resource = getMigrationResource(mappedSchema)
|
||||
when {
|
||||
resource != null -> resource
|
||||
failOnMigrationMissing -> throw IllegalStateException("No migration defined for schema: ${mappedSchema.name} v${mappedSchema.version}")
|
||||
else -> {
|
||||
logger.warn("No migration defined for schema: ${mappedSchema.name} v${mappedSchema.version}")
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,7 +51,7 @@ class SchemaMigration(val schemas: Set<MappedSchema>, val dataSource: DataSource
|
||||
|
||||
if (path == dynamicInclude) {
|
||||
//create a map in liquibase format including all migration files
|
||||
val includeAllFiles = mapOf("databaseChangeLog" to changelogList.map { file -> mapOf("include" to mapOf("file" to file)) })
|
||||
val includeAllFiles = mapOf("databaseChangeLog" to changelogList.filter { it != null }.map { file -> mapOf("include" to mapOf("file" to file)) })
|
||||
|
||||
// transform it to json
|
||||
val includeAllFilesJson = ObjectMapper().writeValueAsBytes(includeAllFiles)
|
||||
|
@ -3,7 +3,7 @@
|
||||
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="tudormalene (generated)" id="1512743551377-1">
|
||||
<changeSet author="R3.Corda" id="1512743551377-1">
|
||||
|
||||
<createTable tableName="messages">
|
||||
<column name="output_index" type="INT">
|
||||
|
@ -42,7 +42,7 @@ class ArgsParser {
|
||||
private val justGenerateNodeInfoArg = optionParser.accepts("just-generate-node-info",
|
||||
"Perform the node start-up task necessary to generate its nodeInfo, save it to disk, then quit")
|
||||
private val justGenerateDatabaseMigrationArg = optionParser
|
||||
.accepts("just-generate-database-migration", "Generate the database migration in the specified output file, and then quit.")
|
||||
.accepts("just-generate-db-migration", "Generate the database migration in the specified output file, and then quit.")
|
||||
.withOptionalArg()
|
||||
private val bootstrapRaftClusterArg = optionParser.accepts("bootstrap-raft-cluster", "Bootstraps Raft cluster. The node forms a single node cluster (ignoring otherwise configured peer addresses), acting as a seed for other nodes to join the cluster.")
|
||||
private val helpArg = optionParser.accepts("help").forHelp()
|
||||
|
@ -68,10 +68,7 @@ import net.corda.nodeapi.internal.crypto.X509Utilities
|
||||
import net.corda.nodeapi.internal.crypto.loadKeyStore
|
||||
import net.corda.nodeapi.internal.network.NETWORK_PARAMS_FILE_NAME
|
||||
import net.corda.nodeapi.internal.network.NetworkParameters
|
||||
import net.corda.nodeapi.internal.persistence.CordaPersistence
|
||||
import net.corda.nodeapi.internal.persistence.DatabaseConfig
|
||||
import net.corda.nodeapi.internal.persistence.HibernateConfiguration
|
||||
import net.corda.nodeapi.internal.persistence.SchemaMigration
|
||||
import net.corda.nodeapi.internal.persistence.*
|
||||
import org.apache.activemq.artemis.utils.ReusableLatch
|
||||
import org.hibernate.type.descriptor.java.JavaTypeDescriptorRegistry
|
||||
import org.slf4j.Logger
|
||||
@ -206,13 +203,15 @@ abstract class AbstractNode(val configuration: NodeConfiguration,
|
||||
|
||||
fun generateDatabaseSchema(outputFile: String) {
|
||||
HikariDataSource(HikariConfig(configuration.dataSourceProperties)).use { dataSource ->
|
||||
SchemaMigration(cordappLoader.cordappSchemas, dataSource, configuration.database.schema).generateMigrationScript(File(outputFile))
|
||||
val jdbcUrl = configuration.dataSourceProperties.getProperty("url", "")
|
||||
SchemaMigration(cordappLoader.cordappSchemas, dataSource, !isH2Database(jdbcUrl), configuration.database.schema).generateMigrationScript(File(outputFile))
|
||||
}
|
||||
}
|
||||
|
||||
fun runDbMigration() {
|
||||
HikariDataSource(HikariConfig(configuration.dataSourceProperties)).use { dataSource ->
|
||||
SchemaMigration(cordappLoader.cordappSchemas, dataSource, configuration.database.schema).runMigration()
|
||||
val jdbcUrl = configuration.dataSourceProperties.getProperty("url", "")
|
||||
SchemaMigration(cordappLoader.cordappSchemas, dataSource, !isH2Database(jdbcUrl), configuration.database.schema).runMigration()
|
||||
}
|
||||
}
|
||||
|
||||
@ -885,9 +884,11 @@ fun configureDatabase(dataSourceProperties: Properties,
|
||||
|
||||
val attributeConverters = listOf(AbstractPartyToX500NameAsStringConverter(identityService))
|
||||
|
||||
val jdbcUrl = config.dataSourceProperties.getProperty("url", "")
|
||||
|
||||
if (databaseConfig.runMigration) {
|
||||
SchemaMigration(schemaService.schemaOptions.keys, dataSource, databaseConfig.schema).runMigration()
|
||||
SchemaMigration(schemaService.schemaOptions.keys, dataSource, !isH2Database(jdbcUrl), databaseConfig.schema).runMigration()
|
||||
}
|
||||
|
||||
return CordaPersistence(dataSource, databaseConfig, schemaService.schemaOptions.keys, config.dataSourceProperties.getProperty("url", ""), attributeConverters)
|
||||
return CordaPersistence(dataSource, databaseConfig, schemaService.schemaOptions.keys, jdbcUrl, attributeConverters)
|
||||
}
|
||||
|
@ -80,7 +80,8 @@ object VaultSchemaV1 : MappedSchema(schemaFamily = VaultSchema.javaClass, versio
|
||||
@CollectionTable(name = "vault_linear_states_parts",
|
||||
joinColumns = arrayOf(
|
||||
JoinColumn(name = "output_index", referencedColumnName = "output_index"),
|
||||
JoinColumn(name = "transaction_id", referencedColumnName = "transaction_id")))
|
||||
JoinColumn(name = "transaction_id", referencedColumnName = "transaction_id")),
|
||||
foreignKey = ForeignKey(name = "FK__lin_stat_parts__lin_stat"))
|
||||
@Column(name = "participants")
|
||||
var participants: MutableSet<AbstractParty>? = null,
|
||||
// Reason for not using Set is described here:
|
||||
@ -112,7 +113,8 @@ object VaultSchemaV1 : MappedSchema(schemaFamily = VaultSchema.javaClass, versio
|
||||
@CollectionTable(name = "vault_fungible_states_parts",
|
||||
joinColumns = arrayOf(
|
||||
JoinColumn(name = "output_index", referencedColumnName = "output_index"),
|
||||
JoinColumn(name = "transaction_id", referencedColumnName = "transaction_id")))
|
||||
JoinColumn(name = "transaction_id", referencedColumnName = "transaction_id")),
|
||||
foreignKey = ForeignKey(name = "FK__fung_st_parts__fung_st"))
|
||||
@Column(name = "participants")
|
||||
var participants: MutableSet<AbstractParty>? = null,
|
||||
|
||||
|
@ -1,238 +0,0 @@
|
||||
|
||||
create table node_link_nodeinfo_party (
|
||||
node_info_id int4 not null,
|
||||
party_name varchar(255) not null
|
||||
);
|
||||
|
||||
|
||||
create table node_attachments (
|
||||
att_id varchar(255) not null,
|
||||
content oid,
|
||||
filename varchar(255),
|
||||
insertion_date timestamp not null,
|
||||
uploader varchar(255),
|
||||
primary key (att_id)
|
||||
);
|
||||
|
||||
|
||||
create table node_bft_committed_states (
|
||||
output_index int4 not null,
|
||||
transaction_id varchar(64) not null,
|
||||
consuming_input_index int4,
|
||||
consuming_transaction_id varchar(255),
|
||||
requesting_party_name varchar(255),
|
||||
requesting_party_key bytea,
|
||||
primary key (output_index, transaction_id)
|
||||
);
|
||||
|
||||
|
||||
create table node_checkpoints (
|
||||
checkpoint_id varchar(64) not null,
|
||||
checkpoint_value oid,
|
||||
primary key (checkpoint_id)
|
||||
);
|
||||
|
||||
|
||||
create table node_contract_upgrades (
|
||||
state_ref varchar(96) not null,
|
||||
contract_class_name varchar(255),
|
||||
primary key (state_ref)
|
||||
);
|
||||
|
||||
|
||||
create table node_identities (
|
||||
pk_hash varchar(130) not null,
|
||||
identity_value oid,
|
||||
primary key (pk_hash)
|
||||
);
|
||||
|
||||
|
||||
create table node_info_hosts (
|
||||
host varchar(255) not null,
|
||||
port int4 not null,
|
||||
node_info_id int4,
|
||||
primary key (host, port)
|
||||
);
|
||||
|
||||
|
||||
create table node_info_party_cert (
|
||||
party_name varchar(255) not null,
|
||||
isMain boolean not null,
|
||||
owning_key_hash varchar(130),
|
||||
party_cert_binary oid,
|
||||
primary key (party_name)
|
||||
);
|
||||
|
||||
|
||||
create table node_infos (
|
||||
node_info_id int4 not null,
|
||||
node_info_hash varchar(64),
|
||||
platform_version int4,
|
||||
serial int8,
|
||||
primary key (node_info_id)
|
||||
);
|
||||
|
||||
|
||||
create table node_message_ids (
|
||||
message_id varchar(36) not null,
|
||||
insertion_time timestamp,
|
||||
primary key (message_id)
|
||||
);
|
||||
|
||||
|
||||
create table node_message_retry (
|
||||
message_id int8 not null,
|
||||
message oid,
|
||||
recipients oid,
|
||||
primary key (message_id)
|
||||
);
|
||||
|
||||
|
||||
create table node_named_identities (
|
||||
name varchar(128) not null,
|
||||
pk_hash varchar(130),
|
||||
primary key (name)
|
||||
);
|
||||
|
||||
|
||||
create table node_notary_commit_log (
|
||||
output_index int4 not null,
|
||||
transaction_id varchar(64) not null,
|
||||
consuming_input_index int4,
|
||||
consuming_transaction_id varchar(255),
|
||||
requesting_party_name varchar(255),
|
||||
requesting_party_key bytea,
|
||||
primary key (output_index, transaction_id)
|
||||
);
|
||||
|
||||
|
||||
create table node_our_key_pairs (
|
||||
public_key_hash varchar(130) not null,
|
||||
private_key oid,
|
||||
public_key oid,
|
||||
primary key (public_key_hash)
|
||||
);
|
||||
|
||||
|
||||
create table node_raft_committed_states (
|
||||
id varchar(255) not null,
|
||||
state_index int8,
|
||||
state_value oid,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
|
||||
create table node_scheduled_states (
|
||||
output_index int4 not null,
|
||||
transaction_id varchar(64) not null,
|
||||
scheduled_at timestamp not null,
|
||||
primary key (output_index, transaction_id)
|
||||
);
|
||||
|
||||
|
||||
create table node_transaction_mappings (
|
||||
tx_id varchar(64) not null,
|
||||
state_machine_run_id varchar(36),
|
||||
primary key (tx_id)
|
||||
);
|
||||
|
||||
|
||||
create table node_transactions (
|
||||
tx_id varchar(64) not null,
|
||||
transaction_value oid,
|
||||
primary key (tx_id)
|
||||
);
|
||||
|
||||
|
||||
create table vault_fungible_states (
|
||||
output_index int4 not null,
|
||||
transaction_id varchar(64) not null,
|
||||
issuer_name varchar(255),
|
||||
issuer_ref bytea,
|
||||
owner_name varchar(255),
|
||||
quantity int8,
|
||||
primary key (output_index, transaction_id)
|
||||
);
|
||||
|
||||
|
||||
create table vault_fungible_states_parts (
|
||||
output_index int4 not null,
|
||||
transaction_id varchar(64) not null,
|
||||
participants varchar(255)
|
||||
);
|
||||
|
||||
|
||||
create table vault_linear_states (
|
||||
output_index int4 not null,
|
||||
transaction_id varchar(64) not null,
|
||||
external_id varchar(255),
|
||||
uuid bytea not null,
|
||||
primary key (output_index, transaction_id)
|
||||
);
|
||||
|
||||
|
||||
create table vault_linear_states_parts (
|
||||
output_index int4 not null,
|
||||
transaction_id varchar(64) not null,
|
||||
participants varchar(255)
|
||||
);
|
||||
|
||||
|
||||
create table vault_states (
|
||||
output_index int4 not null,
|
||||
transaction_id varchar(64) not null,
|
||||
consumed_timestamp timestamp,
|
||||
contract_state_class_name varchar(255),
|
||||
lock_id varchar(255),
|
||||
lock_timestamp timestamp,
|
||||
notary_name varchar(255),
|
||||
recorded_timestamp timestamp,
|
||||
state_status int4,
|
||||
primary key (output_index, transaction_id)
|
||||
);
|
||||
|
||||
|
||||
create table vault_transaction_notes (
|
||||
seq_no int4 not null,
|
||||
note varchar(255),
|
||||
transaction_id varchar(64),
|
||||
primary key (seq_no)
|
||||
);
|
||||
|
||||
create index att_id_idx on node_attachments (att_id);
|
||||
create index external_id_index on vault_linear_states (external_id);
|
||||
create index uuid_index on vault_linear_states (uuid);
|
||||
create index state_status_idx on vault_states (state_status);
|
||||
create index lock_id_idx on vault_states (lock_id, state_status);
|
||||
create index transaction_id_index on vault_transaction_notes (transaction_id);
|
||||
create sequence hibernate_sequence start 1 increment 1;
|
||||
|
||||
|
||||
alter table node_link_nodeinfo_party
|
||||
add constraint FK1ua3h6nwwfji0mn23c5d1xx8e
|
||||
foreign key (party_name)
|
||||
references node_info_party_cert;
|
||||
|
||||
|
||||
alter table node_link_nodeinfo_party
|
||||
add constraint FK544l9wsec35ph7hxrtwfd2lws
|
||||
foreign key (node_info_id)
|
||||
references node_infos;
|
||||
|
||||
|
||||
alter table node_info_hosts
|
||||
add constraint FK5ie46htdrkftmwe6rpwrnp0mp
|
||||
foreign key (node_info_id)
|
||||
references node_infos;
|
||||
|
||||
|
||||
alter table vault_fungible_states_parts
|
||||
add constraint FKchmfeq1ldqnoq9idv9ogxauqm
|
||||
foreign key (output_index, transaction_id)
|
||||
references vault_fungible_states;
|
||||
|
||||
|
||||
alter table vault_linear_states_parts
|
||||
add constraint FKhafsv733d0bo9j1tg352koq3y
|
||||
foreign key (output_index, transaction_id)
|
||||
references vault_linear_states;
|
@ -1,236 +0,0 @@
|
||||
create table node_link_nodeinfo_party (
|
||||
node_info_id int not null,
|
||||
party_name varchar(255) not null
|
||||
);
|
||||
|
||||
|
||||
create table node_attachments (
|
||||
att_id varchar(255) not null,
|
||||
content varbinary(MAX),
|
||||
filename varchar(255),
|
||||
insertion_date datetime2 not null,
|
||||
uploader varchar(255),
|
||||
primary key (att_id)
|
||||
);
|
||||
|
||||
|
||||
create table node_bft_committed_states (
|
||||
output_index int not null,
|
||||
transaction_id varchar(64) not null,
|
||||
consuming_input_index int,
|
||||
consuming_transaction_id varchar(255),
|
||||
requesting_party_name varchar(255),
|
||||
requesting_party_key varbinary(255),
|
||||
primary key (output_index, transaction_id)
|
||||
);
|
||||
|
||||
|
||||
create table node_checkpoints (
|
||||
checkpoint_id varchar(64) not null,
|
||||
checkpoint_value varbinary(MAX),
|
||||
primary key (checkpoint_id)
|
||||
);
|
||||
|
||||
|
||||
create table node_contract_upgrades (
|
||||
state_ref varchar(96) not null,
|
||||
contract_class_name varchar(255),
|
||||
primary key (state_ref)
|
||||
);
|
||||
|
||||
|
||||
create table node_identities (
|
||||
pk_hash varchar(130) not null,
|
||||
identity_value varbinary(MAX),
|
||||
primary key (pk_hash)
|
||||
);
|
||||
|
||||
|
||||
create table node_info_hosts (
|
||||
host varchar(255) not null,
|
||||
port int not null,
|
||||
node_info_id int,
|
||||
primary key (host, port)
|
||||
);
|
||||
|
||||
|
||||
create table node_info_party_cert (
|
||||
party_name varchar(255) not null,
|
||||
isMain bit not null,
|
||||
owning_key_hash varchar(130),
|
||||
party_cert_binary varbinary(MAX),
|
||||
primary key (party_name)
|
||||
);
|
||||
|
||||
|
||||
create table node_infos (
|
||||
node_info_id int not null,
|
||||
node_info_hash varchar(64),
|
||||
platform_version int,
|
||||
serial bigint,
|
||||
primary key (node_info_id)
|
||||
);
|
||||
|
||||
|
||||
create table node_message_ids (
|
||||
message_id varchar(36) not null,
|
||||
insertion_time datetime2,
|
||||
primary key (message_id)
|
||||
);
|
||||
|
||||
|
||||
create table node_message_retry (
|
||||
message_id bigint not null,
|
||||
message varbinary(MAX),
|
||||
recipients varbinary(MAX),
|
||||
primary key (message_id)
|
||||
);
|
||||
|
||||
|
||||
create table node_named_identities (
|
||||
name varchar(128) not null,
|
||||
pk_hash varchar(130),
|
||||
primary key (name)
|
||||
);
|
||||
|
||||
|
||||
create table node_notary_commit_log (
|
||||
output_index int not null,
|
||||
transaction_id varchar(64) not null,
|
||||
consuming_input_index int,
|
||||
consuming_transaction_id varchar(255),
|
||||
requesting_party_name varchar(255),
|
||||
requesting_party_key varbinary(255),
|
||||
primary key (output_index, transaction_id)
|
||||
);
|
||||
|
||||
|
||||
create table node_our_key_pairs (
|
||||
public_key_hash varchar(130) not null,
|
||||
private_key varbinary(MAX),
|
||||
public_key varbinary(MAX),
|
||||
primary key (public_key_hash)
|
||||
);
|
||||
|
||||
|
||||
create table node_raft_committed_states (
|
||||
id varchar(255) not null,
|
||||
state_index bigint,
|
||||
state_value varbinary(MAX),
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
|
||||
create table node_scheduled_states (
|
||||
output_index int not null,
|
||||
transaction_id varchar(64) not null,
|
||||
scheduled_at datetime2 not null,
|
||||
primary key (output_index, transaction_id)
|
||||
);
|
||||
|
||||
|
||||
create table node_transaction_mappings (
|
||||
tx_id varchar(64) not null,
|
||||
state_machine_run_id varchar(36),
|
||||
primary key (tx_id)
|
||||
);
|
||||
|
||||
|
||||
create table node_transactions (
|
||||
tx_id varchar(64) not null,
|
||||
transaction_value varbinary(MAX),
|
||||
primary key (tx_id)
|
||||
);
|
||||
|
||||
|
||||
create table vault_fungible_states (
|
||||
output_index int not null,
|
||||
transaction_id varchar(64) not null,
|
||||
issuer_name varchar(255),
|
||||
issuer_ref varbinary(512),
|
||||
owner_name varchar(255),
|
||||
quantity bigint,
|
||||
primary key (output_index, transaction_id)
|
||||
);
|
||||
|
||||
|
||||
create table vault_fungible_states_parts (
|
||||
output_index int not null,
|
||||
transaction_id varchar(64) not null,
|
||||
participants varchar(255)
|
||||
);
|
||||
|
||||
|
||||
create table vault_linear_states (
|
||||
output_index int not null,
|
||||
transaction_id varchar(64) not null,
|
||||
external_id varchar(255),
|
||||
uuid binary(255) not null,
|
||||
primary key (output_index, transaction_id)
|
||||
);
|
||||
|
||||
|
||||
create table vault_linear_states_parts (
|
||||
output_index int not null,
|
||||
transaction_id varchar(64) not null,
|
||||
participants varchar(255)
|
||||
);
|
||||
|
||||
|
||||
create table vault_states (
|
||||
output_index int not null,
|
||||
transaction_id varchar(64) not null,
|
||||
consumed_timestamp datetime2,
|
||||
contract_state_class_name varchar(255),
|
||||
lock_id varchar(255),
|
||||
lock_timestamp datetime2,
|
||||
notary_name varchar(255),
|
||||
recorded_timestamp datetime2,
|
||||
state_status int,
|
||||
primary key (output_index, transaction_id)
|
||||
);
|
||||
|
||||
|
||||
create table vault_transaction_notes (
|
||||
seq_no int not null,
|
||||
note varchar(255),
|
||||
transaction_id varchar(64),
|
||||
primary key (seq_no)
|
||||
);
|
||||
create index att_id_idx on node_attachments (att_id);
|
||||
create index external_id_index on vault_linear_states (external_id);
|
||||
create index uuid_index on vault_linear_states (uuid);
|
||||
create index state_status_idx on vault_states (state_status);
|
||||
create index lock_id_idx on vault_states (lock_id, state_status);
|
||||
create index transaction_id_index on vault_transaction_notes (transaction_id);
|
||||
create sequence hibernate_sequence start with 1 increment by 1;
|
||||
|
||||
|
||||
alter table node_link_nodeinfo_party
|
||||
add constraint FK1ua3h6nwwfji0mn23c5d1xx8e
|
||||
foreign key (party_name)
|
||||
references node_info_party_cert;
|
||||
|
||||
|
||||
alter table node_link_nodeinfo_party
|
||||
add constraint FK544l9wsec35ph7hxrtwfd2lws
|
||||
foreign key (node_info_id)
|
||||
references node_infos;
|
||||
|
||||
|
||||
alter table node_info_hosts
|
||||
add constraint FK5ie46htdrkftmwe6rpwrnp0mp
|
||||
foreign key (node_info_id)
|
||||
references node_infos;
|
||||
|
||||
|
||||
alter table vault_fungible_states_parts
|
||||
add constraint FKchmfeq1ldqnoq9idv9ogxauqm
|
||||
foreign key (output_index, transaction_id)
|
||||
references vault_fungible_states;
|
||||
|
||||
|
||||
alter table vault_linear_states_parts
|
||||
add constraint FKhafsv733d0bo9j1tg352koq3y
|
||||
foreign key (output_index, transaction_id)
|
||||
references vault_linear_states;
|
@ -4,29 +4,17 @@
|
||||
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="tudormalene (generated)" id="1511451595465-1" dbms="mssql">
|
||||
<changeSet author="R3.Corda" id="1511451595465-1" dbms="mssql">
|
||||
<createSequence sequenceName="hibernate_sequence" minValue="1"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-1.2" dbms="azure">
|
||||
<changeSet author="R3.Corda" id="1511451595465-1.2" dbms="azure">
|
||||
<createSequence sequenceName="hibernate_sequence" minValue="1"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-1.1" dbms="h2">
|
||||
<changeSet author="R3.Corda" id="1511451595465-1.1" dbms="h2">
|
||||
<createSequence sequenceName="hibernate_sequence"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-1.3" dbms="postgresql">
|
||||
<changeSet author="R3.Corda" id="1511451595465-1.3" dbms="postgresql">
|
||||
<createSequence sequenceName="hibernate_sequence" minValue="1"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet author="tudormalene (generated)" id="create state_participants table">
|
||||
<createTable tableName="state_participants">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="transaction_id" type="NVARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="participants" type="NVARCHAR(255)"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
|
@ -3,7 +3,7 @@
|
||||
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="tudormalene (generated)" id="1511451595465-4">
|
||||
<changeSet author="R3.Corda" id="1511451595465-4">
|
||||
<createTable tableName="node_link_nodeinfo_party">
|
||||
<column name="node_info_id" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -13,7 +13,7 @@
|
||||
</column>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-10">
|
||||
<changeSet author="R3.Corda" id="1511451595465-10">
|
||||
<createTable tableName="node_info_hosts">
|
||||
<column name="host" type="NVARCHAR(255)">
|
||||
<constraints nullable="false"/>
|
||||
@ -24,7 +24,7 @@
|
||||
<column name="node_info_id" type="INT"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-11">
|
||||
<changeSet author="R3.Corda" id="1511451595465-11">
|
||||
<createTable tableName="node_info_party_cert">
|
||||
<column name="party_name" type="NVARCHAR(255)">
|
||||
<constraints nullable="false"/>
|
||||
@ -36,7 +36,7 @@
|
||||
<column name="party_cert_binary" type="blob"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-12">
|
||||
<changeSet author="R3.Corda" id="1511451595465-12">
|
||||
<createTable tableName="node_infos">
|
||||
<column name="node_info_id" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -46,27 +46,25 @@
|
||||
<column name="serial" type="BIGINT"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-35">
|
||||
<changeSet author="R3.Corda" id="1511451595465-35">
|
||||
<addPrimaryKey columnNames="host, port" constraintName="node_info_hosts_pkey" tableName="node_info_hosts"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-36">
|
||||
<changeSet author="R3.Corda" id="1511451595465-36">
|
||||
<addPrimaryKey columnNames="party_name" constraintName="node_info_party_cert_pkey"
|
||||
tableName="node_info_party_cert"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-37">
|
||||
<changeSet author="R3.Corda" id="1511451595465-37">
|
||||
<addPrimaryKey columnNames="node_info_id" constraintName="node_infos_pkey" tableName="node_infos"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-62">
|
||||
<changeSet author="R3.Corda" id="1511451595465-62">
|
||||
<addForeignKeyConstraint baseColumnNames="node_info_id" baseTableName="node_link_nodeinfo_party"
|
||||
constraintName="FK__node_link_nodeinfo_party__node_infos" deferrable="false"
|
||||
initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
|
||||
constraintName="FK__link_nodeinfo_party__infos"
|
||||
referencedColumnNames="node_info_id" referencedTableName="node_infos"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-63">
|
||||
<changeSet author="R3.Corda" id="1511451595465-63">
|
||||
<addForeignKeyConstraint baseColumnNames="node_info_id" baseTableName="node_info_hosts"
|
||||
constraintName="FK__node_info_hosts__node_infos" deferrable="false"
|
||||
initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
|
||||
constraintName="FK__info_hosts__infos"
|
||||
referencedColumnNames="node_info_id" referencedTableName="node_infos"/>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
|
@ -4,7 +4,7 @@
|
||||
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="tudormalene (generated)" id="1511451595465-5">
|
||||
<changeSet author="R3.Corda" id="1511451595465-5">
|
||||
<createTable tableName="node_attachments">
|
||||
<column name="att_id" type="NVARCHAR(255)">
|
||||
<constraints nullable="false"/>
|
||||
@ -17,7 +17,7 @@
|
||||
<column name="uploader" type="NVARCHAR(255)"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-6">
|
||||
<changeSet author="R3.Corda" id="1511451595465-6">
|
||||
<createTable tableName="node_bft_committed_states">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -31,7 +31,7 @@
|
||||
<column name="requesting_party_key" type="varbinary(255)"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-7">
|
||||
<changeSet author="R3.Corda" id="1511451595465-7">
|
||||
<createTable tableName="node_checkpoints">
|
||||
<column name="checkpoint_id" type="NVARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
@ -39,7 +39,7 @@
|
||||
<column name="checkpoint_value" type="blob"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-8">
|
||||
<changeSet author="R3.Corda" id="1511451595465-8">
|
||||
<createTable tableName="node_contract_upgrades">
|
||||
<column name="state_ref" type="NVARCHAR(96)">
|
||||
<constraints nullable="false"/>
|
||||
@ -47,7 +47,7 @@
|
||||
<column name="contract_class_name" type="NVARCHAR(255)"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-9">
|
||||
<changeSet author="R3.Corda" id="1511451595465-9">
|
||||
<createTable tableName="node_identities">
|
||||
<column name="pk_hash" type="NVARCHAR(130)">
|
||||
<constraints nullable="false"/>
|
||||
@ -56,7 +56,7 @@
|
||||
</createTable>
|
||||
</changeSet>
|
||||
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-13">
|
||||
<changeSet author="R3.Corda" id="1511451595465-13">
|
||||
<createTable tableName="node_message_ids">
|
||||
<column name="message_id" type="NVARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
@ -64,7 +64,7 @@
|
||||
<column name="insertion_time" type="timestamp"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-14">
|
||||
<changeSet author="R3.Corda" id="1511451595465-14">
|
||||
<createTable tableName="node_message_retry">
|
||||
<column name="message_id" type="BIGINT">
|
||||
<constraints nullable="false"/>
|
||||
@ -73,7 +73,7 @@
|
||||
<column name="recipients" type="blob"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-15">
|
||||
<changeSet author="R3.Corda" id="1511451595465-15">
|
||||
<createTable tableName="node_named_identities">
|
||||
<column name="name" type="NVARCHAR(128)">
|
||||
<constraints nullable="false"/>
|
||||
@ -81,7 +81,7 @@
|
||||
<column name="pk_hash" type="NVARCHAR(130)"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-16">
|
||||
<changeSet author="R3.Corda" id="1511451595465-16">
|
||||
<createTable tableName="node_notary_commit_log">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -95,7 +95,7 @@
|
||||
<column name="requesting_party_key" type="varbinary(255)"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-17">
|
||||
<changeSet author="R3.Corda" id="1511451595465-17">
|
||||
<createTable tableName="node_our_key_pairs">
|
||||
<column name="public_key_hash" type="NVARCHAR(130)">
|
||||
<constraints nullable="false"/>
|
||||
@ -104,7 +104,7 @@
|
||||
<column name="public_key" type="blob"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-18">
|
||||
<changeSet author="R3.Corda" id="1511451595465-18">
|
||||
<createTable tableName="node_raft_committed_states">
|
||||
<column name="id" type="NVARCHAR(255)">
|
||||
<constraints nullable="false"/>
|
||||
@ -113,7 +113,7 @@
|
||||
<column name="state_value" type="blob"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-19">
|
||||
<changeSet author="R3.Corda" id="1511451595465-19">
|
||||
<createTable tableName="node_scheduled_states">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -126,7 +126,7 @@
|
||||
</column>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-20">
|
||||
<changeSet author="R3.Corda" id="1511451595465-20">
|
||||
<createTable tableName="node_transaction_mappings">
|
||||
<column name="tx_id" type="NVARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
@ -134,7 +134,7 @@
|
||||
<column name="state_machine_run_id" type="NVARCHAR(36)"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-21">
|
||||
<changeSet author="R3.Corda" id="1511451595465-21">
|
||||
<createTable tableName="node_transactions">
|
||||
<column name="tx_id" type="NVARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
@ -142,7 +142,7 @@
|
||||
<column name="transaction_value" type="blob"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene" id="create mutual exclusion">
|
||||
<changeSet author="R3.Corda" id="create mutual exclusion">
|
||||
<createTable tableName="node_mutual_exclusion">
|
||||
<column name="mutual_exclusion_id" type="NCHAR(255)">
|
||||
<constraints nullable="false"/>
|
||||
@ -153,61 +153,65 @@
|
||||
</createTable>
|
||||
<addPrimaryKey columnNames="mutual_exclusion_id" constraintName="node_mutual_exclusion_pkey" tableName="node_mutual_exclusion"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-30">
|
||||
<changeSet author="R3.Corda" id="1511451595465-30">
|
||||
<addPrimaryKey columnNames="att_id" constraintName="node_attachments_pkey" tableName="node_attachments"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-31">
|
||||
<changeSet author="R3.Corda" id="1511451595465-31">
|
||||
<addPrimaryKey columnNames="output_index, transaction_id" constraintName="node_bft_committed_states_pkey"
|
||||
tableName="node_bft_committed_states"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-32">
|
||||
<changeSet author="R3.Corda" id="1511451595465-32">
|
||||
<addPrimaryKey columnNames="checkpoint_id" constraintName="node_checkpoints_pkey" tableName="node_checkpoints"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-33">
|
||||
<changeSet author="R3.Corda" id="1511451595465-33">
|
||||
<addPrimaryKey columnNames="state_ref" constraintName="node_contract_upgrades_pkey"
|
||||
tableName="node_contract_upgrades"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-34">
|
||||
<changeSet author="R3.Corda" id="1511451595465-34">
|
||||
<addPrimaryKey columnNames="pk_hash" constraintName="node_identities_pkey" tableName="node_identities"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-38">
|
||||
<changeSet author="R3.Corda" id="1511451595465-38">
|
||||
<addPrimaryKey columnNames="message_id" constraintName="node_message_ids_pkey" tableName="node_message_ids"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-39">
|
||||
<changeSet author="R3.Corda" id="1511451595465-39">
|
||||
<addPrimaryKey columnNames="message_id" constraintName="node_message_retry_pkey"
|
||||
tableName="node_message_retry"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-40">
|
||||
<changeSet author="R3.Corda" id="1511451595465-40">
|
||||
<addPrimaryKey columnNames="name" constraintName="node_named_identities_pkey"
|
||||
tableName="node_named_identities"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-41">
|
||||
<changeSet author="R3.Corda" id="1511451595465-41">
|
||||
<addPrimaryKey columnNames="output_index, transaction_id" constraintName="node_notary_commit_log_pkey"
|
||||
tableName="node_notary_commit_log"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-42">
|
||||
<changeSet author="R3.Corda" id="1511451595465-42">
|
||||
<addPrimaryKey columnNames="public_key_hash" constraintName="node_our_key_pairs_pkey"
|
||||
tableName="node_our_key_pairs"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-43">
|
||||
<addPrimaryKey columnNames="id" constraintName="node_raft_committed_states_pkey"
|
||||
<changeSet author="R3.Corda" id="1511451595465-43">
|
||||
<addPrimaryKey columnNames="id" constraintName="node_raft_comm_states_pkey"
|
||||
tableName="node_raft_committed_states"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-44">
|
||||
<changeSet author="R3.Corda" id="1511451595465-44">
|
||||
<addPrimaryKey columnNames="output_index, transaction_id" constraintName="node_scheduled_states_pkey"
|
||||
tableName="node_scheduled_states"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-45">
|
||||
<changeSet author="R3.Corda" id="1511451595465-45">
|
||||
<addPrimaryKey columnNames="tx_id" constraintName="node_transaction_mappings_pkey"
|
||||
tableName="node_transaction_mappings"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-46">
|
||||
<changeSet author="R3.Corda" id="1511451595465-46">
|
||||
<addPrimaryKey columnNames="tx_id" constraintName="node_transactions_pkey" tableName="node_transactions"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-61">
|
||||
<changeSet author="R3.Corda" id="1511451595465-61">
|
||||
<addForeignKeyConstraint baseColumnNames="party_name" baseTableName="node_link_nodeinfo_party"
|
||||
constraintName="FK__node_link_nodeinfo_party__node_info_party_cert" deferrable="false"
|
||||
initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
|
||||
constraintName="FK__link_ni_p__info_p_cert"
|
||||
referencedColumnNames="party_name" referencedTableName="node_info_party_cert"/>
|
||||
</changeSet>
|
||||
<changeSet author="R3.Corda" id="add index att_id">
|
||||
<createIndex tableName="node_attachments" indexName="att_id_idx" >
|
||||
<column name="att_id"/>
|
||||
</createIndex>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
|
@ -4,7 +4,7 @@
|
||||
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="tudormalene (generated)" id="1511451595465-22">
|
||||
<changeSet author="R3.Corda" id="1511451595465-22">
|
||||
<createTable tableName="vault_fungible_states">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -18,7 +18,7 @@
|
||||
<column name="quantity" type="BIGINT"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-23">
|
||||
<changeSet author="R3.Corda" id="1511451595465-23">
|
||||
<createTable tableName="vault_fungible_states_parts">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -29,7 +29,7 @@
|
||||
<column name="participants" type="NVARCHAR(255)"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-24">
|
||||
<changeSet author="R3.Corda" id="1511451595465-24">
|
||||
<createTable tableName="vault_linear_states">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -43,7 +43,7 @@
|
||||
</column>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-25">
|
||||
<changeSet author="R3.Corda" id="1511451595465-25">
|
||||
<createTable tableName="vault_linear_states_parts">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -54,7 +54,7 @@
|
||||
<column name="participants" type="NVARCHAR(255)"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-26">
|
||||
<changeSet author="R3.Corda" id="1511451595465-26">
|
||||
<createTable tableName="vault_states">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -71,7 +71,7 @@
|
||||
<column name="state_status" type="INT"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-27">
|
||||
<changeSet author="R3.Corda" id="1511451595465-27">
|
||||
<createTable tableName="vault_transaction_notes">
|
||||
<column name="seq_no" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -80,60 +80,58 @@
|
||||
<column name="transaction_id" type="NVARCHAR(64)"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-47">
|
||||
<changeSet author="R3.Corda" id="1511451595465-47">
|
||||
<addPrimaryKey columnNames="output_index, transaction_id" constraintName="vault_fungible_states_pkey"
|
||||
tableName="vault_fungible_states"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-48">
|
||||
<changeSet author="R3.Corda" id="1511451595465-48">
|
||||
<addPrimaryKey columnNames="output_index, transaction_id" constraintName="vault_linear_states_pkey"
|
||||
tableName="vault_linear_states"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-49">
|
||||
<changeSet author="R3.Corda" id="1511451595465-49">
|
||||
<addPrimaryKey columnNames="output_index, transaction_id" constraintName="vault_states_pkey"
|
||||
tableName="vault_states"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-50">
|
||||
<changeSet author="R3.Corda" id="1511451595465-50">
|
||||
<addPrimaryKey columnNames="seq_no" constraintName="vault_transaction_notes_pkey"
|
||||
tableName="vault_transaction_notes"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-53">
|
||||
<changeSet author="R3.Corda" id="1511451595465-53">
|
||||
<createIndex indexName="external_id_index" tableName="vault_linear_states">
|
||||
<column name="external_id"/>
|
||||
</createIndex>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-55">
|
||||
<changeSet author="R3.Corda" id="1511451595465-55">
|
||||
<createIndex indexName="lock_id_idx" tableName="vault_states">
|
||||
<column name="lock_id"/>
|
||||
<column name="state_status"/>
|
||||
</createIndex>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-58">
|
||||
<changeSet author="R3.Corda" id="1511451595465-58">
|
||||
<createIndex indexName="state_status_idx" tableName="vault_states">
|
||||
<column name="state_status"/>
|
||||
</createIndex>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-59">
|
||||
<changeSet author="R3.Corda" id="1511451595465-59">
|
||||
<createIndex indexName="transaction_id_index" tableName="vault_transaction_notes">
|
||||
<column name="transaction_id"/>
|
||||
</createIndex>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-60">
|
||||
<changeSet author="R3.Corda" id="1511451595465-60">
|
||||
<createIndex indexName="uuid_index" tableName="vault_linear_states">
|
||||
<column name="uuid"/>
|
||||
</createIndex>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-64">
|
||||
<changeSet author="R3.Corda" id="1511451595465-64">
|
||||
<addForeignKeyConstraint baseColumnNames="output_index,transaction_id"
|
||||
baseTableName="vault_fungible_states_parts"
|
||||
constraintName="FK__vault_fungible_states_parts__vault_fungible_states" deferrable="false"
|
||||
initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
|
||||
constraintName="FK__fung_st_parts__fung_st"
|
||||
referencedColumnNames="output_index,transaction_id"
|
||||
referencedTableName="vault_fungible_states"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-65">
|
||||
<changeSet author="R3.Corda" id="1511451595465-65">
|
||||
<addForeignKeyConstraint baseColumnNames="output_index,transaction_id" baseTableName="vault_linear_states_parts"
|
||||
constraintName="FK__vault_linear_states_parts__vault_linear_states" deferrable="false"
|
||||
initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
|
||||
constraintName="FK__lin_stat_parts__lin_stat"
|
||||
referencedColumnNames="output_index,transaction_id"
|
||||
referencedTableName="vault_linear_states"/>
|
||||
</changeSet>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?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="tudormalene (generated)" id="1512743551377-11">
|
||||
<changeSet author="R3.Corda" id="1512743551377-11">
|
||||
<createTable tableName="parents">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -14,7 +14,7 @@
|
||||
<addPrimaryKey columnNames="output_index, transaction_id" constraintName="CONSTRAINT_F" tableName="parents"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet author="tudormalene (generated)" id="1512743551377-18">
|
||||
<changeSet author="R3.Corda" id="1512743551377-18">
|
||||
<createTable tableName="children">
|
||||
<column name="child_id" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?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="tudormalene (generated)" id="perf test cash">
|
||||
<changeSet author="R3.Corda" id="perf test cash">
|
||||
<createTable tableName="contract_pt_cash_states">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -15,15 +15,15 @@
|
||||
<column name="pennies" type="BIGINT"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-28">
|
||||
<changeSet author="R3.Corda" id="1511451595465-28">
|
||||
<addPrimaryKey columnNames="output_index, transaction_id" constraintName="contract_pt_cash_states_pkey" tableName="contract_pt_cash_states"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-51">
|
||||
<changeSet author="R3.Corda" id="1511451595465-51">
|
||||
<createIndex indexName="ccy_pt_code_idx" tableName="contract_pt_cash_states">
|
||||
<column name="ccy_code"/>
|
||||
</createIndex>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-57">
|
||||
<changeSet author="R3.Corda" id="1511451595465-57">
|
||||
<createIndex indexName="pennies_pt_idx" tableName="contract_pt_cash_states">
|
||||
<column name="pennies"/>
|
||||
</createIndex>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?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="tudormalene (generated)" id="1511451595465-3">
|
||||
<changeSet author="R3.Corda" id="1511451595465-3">
|
||||
<createTable tableName="cp_pt_states">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -18,20 +18,20 @@
|
||||
<column name="owner_key_hash" type="NVARCHAR(130)"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-29">
|
||||
<changeSet author="R3.Corda" id="1511451595465-29">
|
||||
<addPrimaryKey columnNames="output_index, transaction_id" constraintName="cp_pt_states_pkey" tableName="cp_pt_states"/>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-52">
|
||||
<changeSet author="R3.Corda" id="1511451595465-52">
|
||||
<createIndex indexName="ccy_cp_pt_code_index" tableName="cp_pt_states">
|
||||
<column name="ccy_code"/>
|
||||
</createIndex>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-54">
|
||||
<changeSet author="R3.Corda" id="1511451595465-54">
|
||||
<createIndex indexName="face_value_cp_pt_index" tableName="cp_pt_states">
|
||||
<column name="face_value"/>
|
||||
</createIndex>
|
||||
</changeSet>
|
||||
<changeSet author="tudormalene (generated)" id="1511451595465-56">
|
||||
<changeSet author="R3.Corda" id="1511451595465-56">
|
||||
<createIndex indexName="maturity_cp_pt_index" tableName="cp_pt_states">
|
||||
<column name="maturity_instant"/>
|
||||
</createIndex>
|
||||
|
@ -31,7 +31,7 @@ class DummyDealContract : Contract {
|
||||
override fun generateMappedObject(schema: MappedSchema): PersistentState {
|
||||
return when (schema) {
|
||||
is DummyDealStateSchemaV1 -> DummyDealStateSchemaV1.PersistentDummyDealState(
|
||||
_participants = participants.toSet(),
|
||||
participants = participants.toMutableSet(),
|
||||
uid = linearId
|
||||
)
|
||||
else -> throw IllegalArgumentException("Unrecognised schema $schema")
|
||||
|
@ -4,9 +4,7 @@ import net.corda.core.contracts.UniqueIdentifier
|
||||
import net.corda.core.identity.AbstractParty
|
||||
import net.corda.core.schemas.CommonSchemaV1
|
||||
import net.corda.core.schemas.MappedSchema
|
||||
import javax.persistence.Entity
|
||||
import javax.persistence.Table
|
||||
import javax.persistence.Transient
|
||||
import javax.persistence.*
|
||||
|
||||
/**
|
||||
* An object used to fully qualify the [DummyDealStateSchema] family name (i.e. independent of version).
|
||||
@ -24,12 +22,16 @@ object DummyDealStateSchemaV1 : MappedSchema(schemaFamily = DummyDealStateSchema
|
||||
@Entity
|
||||
@Table(name = "dummy_deal_states")
|
||||
class PersistentDummyDealState(
|
||||
/** parent attributes */
|
||||
@Transient
|
||||
val _participants: Set<AbstractParty>,
|
||||
|
||||
@ElementCollection
|
||||
@Column(name = "participants")
|
||||
@CollectionTable(name = "dummy_deal_states_participants", joinColumns = arrayOf(
|
||||
JoinColumn(name = "output_index", referencedColumnName = "output_index"),
|
||||
JoinColumn(name = "transaction_id", referencedColumnName = "transaction_id")))
|
||||
override var participants: MutableSet<AbstractParty>? = null,
|
||||
|
||||
@Transient
|
||||
val uid: UniqueIdentifier
|
||||
|
||||
) : CommonSchemaV1.LinearState(uid, _participants)
|
||||
) : CommonSchemaV1.LinearState(uuid = uid.id, externalId = uid.externalId, participants = participants)
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ class DummyLinearContract : Contract {
|
||||
linearBoolean = linearBoolean
|
||||
)
|
||||
is DummyLinearStateSchemaV2 -> DummyLinearStateSchemaV2.PersistentDummyLinearState(
|
||||
_participants = participants.toSet(),
|
||||
participants = participants.toMutableSet(),
|
||||
uid = linearId,
|
||||
linearString = linearString,
|
||||
linearNumber = linearNumber,
|
||||
|
@ -31,7 +31,8 @@ object DummyLinearStateSchemaV1 : MappedSchema(schemaFamily = DummyLinearStateSc
|
||||
|
||||
/** X500Name of participant parties **/
|
||||
@ElementCollection
|
||||
@CollectionTable(name="state_participants",joinColumns = arrayOf(
|
||||
@Column(name = "participants")
|
||||
@CollectionTable(name = "dummy_linear_state_participants", joinColumns = arrayOf(
|
||||
JoinColumn(name = "output_index", referencedColumnName = "output_index"),
|
||||
JoinColumn(name = "transaction_id", referencedColumnName = "transaction_id")))
|
||||
var participants: MutableSet<AbstractParty>,
|
||||
|
@ -4,9 +4,7 @@ import net.corda.core.contracts.UniqueIdentifier
|
||||
import net.corda.core.identity.AbstractParty
|
||||
import net.corda.core.schemas.CommonSchemaV1
|
||||
import net.corda.core.schemas.MappedSchema
|
||||
import javax.persistence.Column
|
||||
import javax.persistence.Entity
|
||||
import javax.persistence.Table
|
||||
import javax.persistence.*
|
||||
|
||||
/**
|
||||
* Second version of a cash contract ORM schema that extends the common
|
||||
@ -20,6 +18,14 @@ object DummyLinearStateSchemaV2 : MappedSchema(schemaFamily = DummyLinearStateSc
|
||||
@Entity
|
||||
@Table(name = "dummy_linear_states_v2")
|
||||
class PersistentDummyLinearState(
|
||||
|
||||
@ElementCollection
|
||||
@Column(name = "participants")
|
||||
@CollectionTable(name = "dummy_linear_states_v2_participants", joinColumns = arrayOf(
|
||||
JoinColumn(name = "output_index", referencedColumnName = "output_index"),
|
||||
JoinColumn(name = "transaction_id", referencedColumnName = "transaction_id")))
|
||||
override var participants: MutableSet<AbstractParty>? = null,
|
||||
|
||||
@Column(name = "linear_string") var linearString: String,
|
||||
|
||||
@Column(name = "linear_number") var linearNumber: Long,
|
||||
@ -28,11 +34,7 @@ object DummyLinearStateSchemaV2 : MappedSchema(schemaFamily = DummyLinearStateSc
|
||||
|
||||
@Column(name = "linear_boolean") var linearBoolean: Boolean,
|
||||
|
||||
/** parent attributes */
|
||||
@Transient
|
||||
val _participants: Set<AbstractParty>,
|
||||
|
||||
@Transient
|
||||
val uid: UniqueIdentifier
|
||||
) : CommonSchemaV1.LinearState(uid, _participants)
|
||||
) : CommonSchemaV1.LinearState(uuid = uid.id, externalId = uid.externalId, participants = participants)
|
||||
}
|
||||
|
@ -1,3 +1,9 @@
|
||||
DROP TABLE IF EXISTS ${schema}.cash_state_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.cash_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.cp_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_linear_state_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_deal_states_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.node_attachments;
|
||||
DROP TABLE IF EXISTS ${schema}.node_checkpoints;
|
||||
DROP TABLE IF EXISTS ${schema}.node_transactions;
|
||||
|
@ -1,3 +1,9 @@
|
||||
DROP TABLE IF EXISTS ${schema}.cash_state_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.cash_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.cp_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_linear_state_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_deal_states_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.node_attachments;
|
||||
DROP TABLE IF EXISTS ${schema}.node_checkpoints;
|
||||
DROP TABLE IF EXISTS ${schema}.node_transactions;
|
||||
|
@ -1,3 +1,9 @@
|
||||
DROP TABLE IF EXISTS ${schema}.cash_state_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.cash_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.cp_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_linear_state_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_deal_states_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.node_attachments;
|
||||
DROP TABLE IF EXISTS ${schema}.node_checkpoints;
|
||||
DROP TABLE IF EXISTS ${schema}.node_transactions;
|
||||
|
@ -1,3 +1,9 @@
|
||||
DROP TABLE IF EXISTS ${schema}.cash_state_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.cash_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.cp_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_linear_state_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_deal_states_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.node_attachments;
|
||||
DROP TABLE IF EXISTS ${schema}.node_checkpoints;
|
||||
DROP TABLE IF EXISTS ${schema}.node_transactions;
|
||||
|
@ -1,3 +1,9 @@
|
||||
DROP TABLE IF EXISTS ${schema}.cash_state_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.cash_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.cp_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_linear_state_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_deal_states_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.node_attachments;
|
||||
DROP TABLE IF EXISTS ${schema}.node_checkpoints;
|
||||
DROP TABLE IF EXISTS ${schema}.node_transactions;
|
||||
|
@ -1,3 +1,9 @@
|
||||
DROP TABLE IF EXISTS ${schema}.cash_state_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.cash_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.cp_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_linear_state_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_deal_states_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.node_attachments;
|
||||
DROP TABLE IF EXISTS ${schema}.node_checkpoints;
|
||||
DROP TABLE IF EXISTS ${schema}.node_transactions;
|
||||
|
@ -1,3 +1,9 @@
|
||||
DROP TABLE IF EXISTS ${schema}.cash_state_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.cash_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.cp_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_linear_state_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_deal_states_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.node_attachments;
|
||||
DROP TABLE IF EXISTS ${schema}.node_checkpoints;
|
||||
DROP TABLE IF EXISTS ${schema}.node_transactions;
|
||||
|
@ -1,3 +1,9 @@
|
||||
DROP TABLE IF EXISTS ${schema}.cash_state_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.cash_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.cp_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_linear_state_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_linear_states_v2_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.dummy_deal_states_participants;
|
||||
DROP TABLE IF EXISTS ${schema}.node_attachments;
|
||||
DROP TABLE IF EXISTS ${schema}.node_checkpoints;
|
||||
DROP TABLE IF EXISTS ${schema}.node_transactions;
|
||||
|
@ -4,7 +4,7 @@
|
||||
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="tudormalene (generated)" id="1512743551377-8">
|
||||
<changeSet author="R3.Corda" id="1512743551377-8">
|
||||
<createTable tableName="dummy_deal_states">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -18,7 +18,25 @@
|
||||
</column>
|
||||
</createTable>
|
||||
|
||||
<addPrimaryKey columnNames="output_index, transaction_id" constraintName="PK_dummy_deal_states"
|
||||
tableName="dummy_deal_states"/>
|
||||
|
||||
<createTable tableName="dummy_deal_states_participants">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="transaction_id" type="NVARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="participants" type="NVARCHAR(255)"/>
|
||||
</createTable>
|
||||
|
||||
<addForeignKeyConstraint baseColumnNames="output_index,transaction_id"
|
||||
baseTableName="dummy_deal_states_participants"
|
||||
constraintName="FKg6ab1fhx6aesnmhlo62o4dnrt"
|
||||
referencedColumnNames="output_index,transaction_id"
|
||||
referencedTableName="dummy_deal_states"/>
|
||||
|
||||
</changeSet>
|
||||
|
||||
|
||||
</databaseChangeLog>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<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">
|
||||
<changeSet author="tudormalene (generated)" id="1512743023716-7">
|
||||
<changeSet author="R3.Corda" id="1512743023716-7">
|
||||
<createTable tableName="dummy_linear_states">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -23,6 +23,22 @@
|
||||
<addPrimaryKey columnNames="output_index, transaction_id" constraintName="CONSTRAINT_6"
|
||||
tableName="dummy_linear_states"/>
|
||||
|
||||
<createTable tableName="dummy_linear_state_participants">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="transaction_id" type="NVARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="participants" type="NVARCHAR(255)"/>
|
||||
</createTable>
|
||||
|
||||
<addForeignKeyConstraint baseColumnNames="output_index,transaction_id"
|
||||
baseTableName="dummy_linear_state_participants"
|
||||
constraintName="FK8y6k4thqq0udg07ojffpbgblq"
|
||||
referencedColumnNames="output_index,transaction_id"
|
||||
referencedTableName="dummy_linear_states"/>
|
||||
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
|
@ -3,7 +3,7 @@
|
||||
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">
|
||||
|
||||
<changeSet author="tudormalene (generated)" id="1512743023716-8">
|
||||
<changeSet author="R3.Corda" id="1512743023716-8">
|
||||
<createTable tableName="dummy_linear_states_v2">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
@ -24,5 +24,21 @@
|
||||
<addPrimaryKey columnNames="output_index, transaction_id" constraintName="CONSTRAINT_E"
|
||||
tableName="dummy_linear_states_v2"/>
|
||||
|
||||
<createTable tableName="dummy_linear_states_v2_participants">
|
||||
<column name="output_index" type="INT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="transaction_id" type="NVARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="participants" type="NVARCHAR(255)"/>
|
||||
</createTable>
|
||||
|
||||
<addForeignKeyConstraint baseColumnNames="output_index,transaction_id"
|
||||
baseTableName="dummy_linear_states_v2_participants"
|
||||
constraintName="FKlfb5dvtmuadsllckeghmjlckk"
|
||||
referencedColumnNames="output_index,transaction_id"
|
||||
referencedTableName="dummy_linear_states_v2"/>
|
||||
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
|
Loading…
Reference in New Issue
Block a user