File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
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 = 35 THEN
9
+ EXECUTE ' alter domain addr29type drop constraint addr29type_check' ;
10
+ EXECUTE ' alter domain asset32type drop constraint asset32type_check' ;
11
+ EXECUTE ' alter domain hash28type drop constraint hash28type_check' ;
12
+ EXECUTE ' alter domain hash32type drop constraint hash32type_check' ;
13
+ EXECUTE ' alter domain int65type drop constraint int65type_check' ;
14
+ EXECUTE ' alter domain lovelace drop constraint lovelace_check' ;
15
+ EXECUTE ' alter domain txindex drop constraint txindex_check' ;
16
+ EXECUTE ' alter domain word128type drop constraint word128type_check' ;
17
+ EXECUTE ' alter domain word31type drop constraint word31type_check' ;
18
+ EXECUTE ' alter domain word63type drop constraint word63type_check' ;
19
+ EXECUTE ' alter domain word64type drop constraint word64type_check' ;
20
+ -- Hand written SQL statements can be added here.
21
+ UPDATE schema_version SET stage_two = next_version ;
22
+ RAISE NOTICE ' DB has been migrated to stage_two version %' , next_version ;
23
+ END IF ;
24
+ END ;
25
+ $$ LANGUAGE plpgsql ;
26
+
27
+ SELECT migrate() ;
28
+
29
+ DROP FUNCTION migrate() ;
You can’t perform that action at this time.
0 commit comments