start work on liquibase schema for new checkpoints

This commit is contained in:
stefano 2020-01-24 13:24:08 +00:00
parent 0619b4ce90
commit 5750c39348
5 changed files with 302 additions and 5 deletions

2
Jenkinsfile vendored
View File

@ -5,7 +5,7 @@ import static com.r3.build.BuildControl.killAllExistingBuildsForJob
killAllExistingBuildsForJob(env.JOB_NAME, env.BUILD_NUMBER.toInteger())
pipeline {
agent { label 'k8s' }
agent { label 'aks' }
options { timestamps() }
environment {

View File

@ -31,4 +31,8 @@
<include file="migration/node-core.changelog-v14-data.xml"/>
<include file="migration/node-core.changelog-v17.xml"/>
<include file="migration/node-core.changelog-v17-postgres.xml"/>
<include file="migration/node-core.changelog-v17-keys.xml"/>
</databaseChangeLog>

View File

@ -0,0 +1,34 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<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"
logicalFilePath="migration/node-services.changelog-init.xml">
<changeSet author="R3.Corda" id="add_new_checkpoint_schema_primary_keys">
<addPrimaryKey columnNames="flow_id" constraintName="node_checkpoints_pk" tableName="node_checkpoints"/>
<addPrimaryKey columnNames="id" constraintName="node_checkpoint_blobs_pk" tableName="node_checkpoint_blobs"/>
<addPrimaryKey columnNames="id" constraintName="node_checkpoint_exceptions_pk" tableName="node_flow_exceptions"/>
<addPrimaryKey columnNames="id" constraintName="node_checkpoint_results_pk" tableName="node_flow_results"/>
<addPrimaryKey columnNames="invocation_id" constraintName="node_flow_metadata_pk" tableName="node_flow_metadata"/>
</changeSet>
<changeSet author="R3.Corda" id="add_new_checkpoint_schema_foreign_keys">
<addForeignKeyConstraint baseColumnNames="checkpoint_blob_id" baseTableName="node_checkpoints"
constraintName="node_checkpoint_blob_id_to_blob_table_fk"
referencedColumnNames="id" referencedTableName="node_checkpoint_blobs"/>
<addForeignKeyConstraint baseColumnNames="error_id" baseTableName="node_checkpoints"
constraintName="node_checkpoints_to_exceptions_fk"
referencedColumnNames="id" referencedTableName="node_flow_exceptions"/>
<addForeignKeyConstraint baseColumnNames="result_id" baseTableName="node_checkpoints"
constraintName="node_checkpoint_to_result_fk"
referencedColumnNames="id" referencedTableName="node_flow_results"/>
<addForeignKeyConstraint baseColumnNames="flow_id" baseTableName="node_flow_metadata"
constraintName="node_metadata_to_checkpoints_fk"
referencedColumnNames="flow_id" referencedTableName="node_checkpoints"/>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,139 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<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"
logicalFilePath="migration/node-services.changelog-init.xml">
<changeSet author="R3.Corda" id="drop_existing_checkpoints_table" dbms="postgresql">
<dropTable tableName="node_checkpoints"/>
</changeSet>
<changeSet author="R3.Corda" id="add_new_checkpoints_table" dbms="postgresql">
<createTable tableName="node_checkpoints">
<column name="flow_id" type="NVARCHAR(64)">
<constraints nullable="false"/>
</column>
<column name="checkpoint_blob_id" type="BIGINT">
<constraints nullable="true"/>
</column>
<column name="result_id" type="BIGINT">
<constraints nullable="true"/>
</column>
<column name="error_id" type="BIGINT">
<constraints nullable="true"/>
</column>
<column name="status" type="NVARCHAR(16)">
<constraints nullable="false"/>
</column>
<column name="compatible" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="progress_step" type="NVARCHAR(32)">
<constraints nullable="true"/>
</column>
<column name="flow_io_request" type="NVARCHAR(32)">
<constraints nullable="true"/>
</column>
<column name="timestamp" type="java.sql.Types.TIMESTAMP">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="R3.Corda" id="add_new_checkpoint_blobs_table" dbms="postgresql">
<createTable tableName="node_checkpoint_blobs">
<column name="id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="checkpoint_value" type="varbinary(33554432)">
<constraints nullable="false"/>
</column>
<column name="flow_state" type="varbinary(33554432)">
<constraints nullable="false"/>
</column>
<column name="timestamp" type="java.sql.Types.TIMESTAMP">
<constraints nullable="false"/>
</column>
<column name="hmac" type="NVARCHAR(32)">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="R3.Corda" id="add_new_flow_result_table" dbms="postgresql">
<createTable tableName="node_flow_results">
<column name="id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="result_value" type="varbinary(33554432)">
<constraints nullable="false"/>
</column>
<column name="timestamp" type="java.sql.Types.TIMESTAMP">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="R3.Corda" id="add_new_flow_exceptions_table" dbms="postgresql">
<createTable tableName="node_flow_exceptions">
<column name="id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="type" type="NVARCHAR(128)">
<constraints nullable="false"/>
</column>
<column name="exception_value" type="varbinary(33554432)">
<constraints nullable="false"/>
</column>
<column name="timestamp" type="java.sql.Types.TIMESTAMP">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="R3.Corda" id="add_new_flow_metadata_table" dbms="postgresql">
<createTable tableName="node_flow_metadata">
<column name="invocation_id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="flow_id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="flow_name" type="NVARCHAR(128)">
<constraints nullable="false"/>
</column>
<column name="flow_identifier" type="NVARCHAR(128)">
<constraints nullable="true"/>
</column>
<column name="started_type" type="NVARCHAR(32)">
<constraints nullable="false"/>
</column>
<column name="flow_parameters" type="varbinary(33554432)">
<constraints nullable="false"/>
</column>
<column name="cordapp_name" type="NVARCHAR(64)">
<constraints nullable="false"/>
</column>
<column name="platform_version" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="rpc_user" type="NVARCHAR(64)">
<constraints nullable="false"/>
</column>
<column name="invocation_time" type="java.sql.Types.TIMESTAMP">
<constraints nullable="false"/>
</column>
<column name="received_time" type="java.sql.Types.TIMESTAMP">
<constraints nullable="false"/>
</column>
<column name="start_time" type="java.sql.Types.TIMESTAMP">
<constraints nullable="true"/>
</column>
<column name="finish_time" type="java.sql.Types.TIMESTAMP">
<constraints nullable="true"/>
</column>
</createTable>
</changeSet>
</databaseChangeLog>

View File

@ -4,16 +4,136 @@
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd"
logicalFilePath="migration/node-services.changelog-init.xml">
<changeSet author="R3.Corda" id="drop_existing_checkpoints_table">
<changeSet author="R3.Corda" id="drop_existing_checkpoints_table" dbms="!postgresql">
<dropTable tableName="node_checkpoints"/>
</changeSet>
<changeSet author="R3.Corda" id="1511451595465-7">
<changeSet author="R3.Corda" id="add_new_checkpoints_table" dbms="!postgresql">
<createTable tableName="node_checkpoints">
<column name="checkpoint_id" type="NVARCHAR(64)">
<column name="flow_id" type="NVARCHAR(64)">
<constraints nullable="false"/>
</column>
<column name="checkpoint_blob_id" type="BIGINT">
<constraints nullable="true"/>
</column>
<column name="result_id" type="BIGINT">
<constraints nullable="true"/>
</column>
<column name="error_id" type="BIGINT">
<constraints nullable="true"/>
</column>
<column name="status" type="NVARCHAR(16)">
<constraints nullable="false"/>
</column>
<column name="compatible" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="progress_step" type="NVARCHAR(32)">
<constraints nullable="true"/>
</column>
<column name="flow_io_request" type="NVARCHAR(32)">
<constraints nullable="true"/>
</column>
<column name="timestamp" type="java.sql.Types.TIMESTAMP">
<constraints nullable="false"/>
</column>
<column name="checkpoint_value" type="blob"/>
</createTable>
</changeSet>
<changeSet author="R3.Corda" id="add_new_checkpoint_blob_table" dbms="!postgresql">
<createTable tableName="node_checkpoint_blobs">
<column name="id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="checkpoint_value" type="blob">
<constraints nullable="false"/>
</column>
<column name="flow_state" type="blob">
<constraints nullable="false"/>
</column>
<column name="timestamp" type="java.sql.Types.TIMESTAMP">
<constraints nullable="false"/>
</column>
<column name="hmac" type="NVARCHAR(32)">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="R3.Corda" id="add_new_flow_result_table" dbms="!postgresql">
<createTable tableName="node_flow_results">
<column name="id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="result_value" type="blob">
<constraints nullable="false"/>
</column>
<column name="timestamp" type="java.sql.Types.TIMESTAMP">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="R3.Corda" id="add_new_flow_exceptions_table" dbms="!postgresql">
<createTable tableName="node_flow_exceptions">
<column name="id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="type" type="NVARCHAR(128)">
<constraints nullable="false"/>
</column>
<column name="exception_value" type="blob">
<constraints nullable="false"/>
</column>
<column name="timestamp" type="java.sql.Types.TIMESTAMP">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="R3.Corda" id="add_new_flow_metadata_table" dbms="!postgresql">
<createTable tableName="node_flow_metadata">
<column name="invocation_id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="flow_id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="flow_name" type="NVARCHAR(128)">
<constraints nullable="false"/>
</column>
<column name="flow_identifier" type="NVARCHAR(128)">
<constraints nullable="true"/>
</column>
<column name="started_type" type="NVARCHAR(32)">
<constraints nullable="false"/>
</column>
<column name="flow_parameters" type="blob">
<constraints nullable="false"/>
</column>
<column name="cordapp_name" type="NVARCHAR(64)">
<constraints nullable="false"/>
</column>
<column name="platform_version" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="rpc_user" type="NVARCHAR(64)">
<constraints nullable="false"/>
</column>
<column name="invocation_time" type="java.sql.Types.TIMESTAMP">
<constraints nullable="false"/>
</column>
<column name="received_time" type="java.sql.Types.TIMESTAMP">
<constraints nullable="false"/>
</column>
<column name="start_time" type="java.sql.Types.TIMESTAMP">
<constraints nullable="true"/>
</column>
<column name="finish_time" type="java.sql.Types.TIMESTAMP">
<constraints nullable="true"/>
</column>
</createTable>
</changeSet>
</databaseChangeLog>