Skip to content

Commit 00c2ff3

Browse files
committed
Add migration to remove redundant tx_out fields
1 parent c86a2ef commit 00c2ff3

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

schema/migration-2-0036-20240117.sql

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
-- Persistent generated migration.
2+
3+
CREATE FUNCTION migrate() RETURNS void AS $$
4+
DECLARE
5+
next_version int ;
6+
BEGIN
7+
SELECT stage_two + 1 INTO next_version FROM schema_version ;
8+
IF next_version = 36 THEN
9+
EXECUTE 'ALTER TABLE "tx_out" DROP COLUMN "address_raw"' ;
10+
11+
EXECUTE 'ALTER TABLE "collateral_tx_out" DROP COLUMN "address_raw"' ;
12+
-- Hand written SQL statements can be added here.
13+
UPDATE schema_version SET stage_two = next_version ;
14+
RAISE NOTICE 'DB has been migrated to stage_two version %', next_version ;
15+
END IF ;
16+
END ;
17+
$$ LANGUAGE plpgsql ;
18+
19+
SELECT migrate() ;
20+
21+
DROP FUNCTION migrate() ;

0 commit comments

Comments
 (0)