Skip to content

Commit

Permalink
CORE-19289 - Updated the table utxo_visible_transaction_output (#1598)
Browse files Browse the repository at this point in the history
Added the column `token_priority` to the database table `utxo_visible_transaction_output`.
Created an index that uses the `token_priority` and `transaction_id` columns.

Note: 
1) Liquibase does not support the creation of an index where NULL values are last unless we write the SQL code ourselves. (See reference: https://docs.liquibase.com/change-types/create-index.html)
2) Postgres reference for creating an index with the `NULLS LAST` option: https://www.postgresql.org/docs/current/indexes-ordering.html
  • Loading branch information
filipesoliveira authored Apr 9, 2024
1 parent c20b644 commit e139e9c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
<include file="net/corda/db/schema/vnode-vault/migration/ledger-utxo-creation-v1.0.xml"/>
<include file="net/corda/db/schema/vnode-vault/migration/ledger-utxo-creation-v5.1.xml"/>
<include file="net/corda/db/schema/vnode-vault/migration/ledger-utxo-creation-v5.2.xml"/>
<include file="net/corda/db/schema/vnode-vault/migration/ledger-utxo-creation-v5.3.xml"/>
<include file="net/corda/db/schema/vnode-vault/migration/vnode-vault-creation-v5.1.xml"/>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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-4.3.xsd">

<changeSet author="R3.Corda" id="ledger-utxo-creation-v5.3">

<addColumn tableName="utxo_visible_transaction_output">
<column name="token_priority" type="BIGINT">
<constraints nullable="true"/>
</column>
</addColumn>

<createIndex indexName="utxo_visible_transaction_output_token_priority_tx_id_idx"
tableName="utxo_visible_transaction_output">
<column name="token_priority"/>
<column name="transaction_id"/>
</createIndex>

</changeSet>

</databaseChangeLog>

0 comments on commit e139e9c

Please sign in to comment.