Skip to content

Commit

Permalink
fix: select correct block hash upon migration (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelcr committed Jun 17, 2024
1 parent a69f438 commit aea1a19
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions migrations/1718498685557_inscriptions-block-hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ export function up(pgm: MigrationBuilder): void {
});
pgm.sql(`
UPDATE inscriptions SET block_hash = (
SELECT block_hash FROM locations AS l WHERE l.ordinal_number = ordinal_number LIMIT 1
)
SELECT block_hash FROM locations AS l
WHERE l.ordinal_number = ordinal_number
AND l.block_height = block_height
AND l.tx_index = tx_index
LIMIT 1
)
`);
pgm.alterColumn('inscriptions', 'block_hash', { notNull: true });
}
Expand Down

0 comments on commit aea1a19

Please sign in to comment.