Skip to content

Commit

Permalink
Fix index of cardano tx table that was tagged as unique
Browse files Browse the repository at this point in the history
This mistake makes this table only retains one transaction per immutable.
  • Loading branch information
Alenar committed Feb 13, 2024
1 parent 5cd9a8d commit 658e162
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
15 changes: 15 additions & 0 deletions mithril-aggregator/src/database/cardano_transaction_migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ create table cardano_tx (
);
create unique index cardano_tx_immutable_file_number_index on cardano_tx(immutable_file_number);
"#,
),
// Migration 2
// Fix the `cardano_tx` table index on immutable_file number, incorrectly marked as unique.
SqlMigration::new(
2,
r#"
-- remove all data from the cardano tx table since a lot of transactions where missing for each
-- block and we rely on their insert order.
delete from table cardano_tx;
drop index cardano_tx_immutable_file_number_index;
create index cardano_tx_immutable_file_number_index on cardano_tx(immutable_file_number);
vacuum;
"#,
),
]
Expand Down
15 changes: 15 additions & 0 deletions mithril-signer/src/database/cardano_transaction_migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ create table cardano_tx (
);
create unique index cardano_tx_immutable_file_number_index on cardano_tx(immutable_file_number);
"#,
),
// Migration 2
// Fix the `cardano_tx` table index on immutable_file number, incorrectly marked as unique.
SqlMigration::new(
2,
r#"
-- remove all data from the cardano tx table since a lot of transactions where missing for each
-- block and we rely on their insert order.
delete from table cardano_tx;
drop index cardano_tx_immutable_file_number_index;
create index cardano_tx_immutable_file_number_index on cardano_tx(immutable_file_number);
vacuum;
"#,
),
]
Expand Down

0 comments on commit 658e162

Please sign in to comment.