Skip to content

Commit 108cb57

Browse files
committed
fix: migration
1 parent 5419a89 commit 108cb57

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/* eslint-disable camelcase */
2+
3+
exports.shorthands = undefined;
4+
5+
exports.up = pgm => {
6+
pgm.sql(`
7+
WITH burn_blocks AS (
8+
SELECT DISTINCT ON (burn_block_height) burn_block_hash, canonical
9+
FROM blocks
10+
ORDER BY burn_block_height DESC, block_height DESC
11+
)
12+
UPDATE burnchain_rewards
13+
SET canonical = (
14+
SELECT canonical
15+
FROM burn_blocks
16+
WHERE burnchain_rewards.burn_block_hash = burn_blocks.burn_block_hash
17+
)
18+
`);
19+
};
20+
21+
exports.down = pgm => {};

0 commit comments

Comments
 (0)