Skip to content

Commit 3d3b5e4

Browse files
Cmdvkderme
authored andcommitted
put back the imagration file
1 parent d8f1b96 commit 3d3b5e4

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

doc/schema.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ A table containing pool offchain data fetch errors.
949949
| `fetch_error` | string | The text of the error. |
950950
| `retry_count` | word31type | The number of retries. |
951951

952-
### `off_chain_anchor_data`
952+
### `off_chain_voting_data`
953953

954954
The table with the offchain metadata related to Vote Anchors. New in 13.2-Conway.
955955

@@ -963,7 +963,7 @@ The table with the offchain metadata related to Vote Anchors. New in 13.2-Conway
963963
| `json` | jsonb | The payload as JSON. |
964964
| `bytes` | bytea | The raw bytes of the payload. |
965965

966-
### `off_chain_anchor_fetch_error`
966+
### `off_chain_voting_fetch_error`
967967

968968
Errors while fetching or validating offchain Voting Anchor metadata. New in 13.2-Conway.
969969

schema/migration-2-0032-20231107.sql

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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 = 32 THEN
9+
EXECUTE 'ALTER TABLE "committee_de_registration" RENAME COLUMN "hot_key" TO "cold_key"' ;
10+
-- Hand written SQL statements can be added here.
11+
UPDATE schema_version SET stage_two = next_version ;
12+
RAISE NOTICE 'DB has been migrated to stage_two version %', next_version ;
13+
END IF ;
14+
END ;
15+
$$ LANGUAGE plpgsql ;
16+
17+
SELECT migrate() ;
18+
19+
DROP FUNCTION migrate() ;

schema/migration-2-0034-20231107.sql renamed to schema/migration-2-0034-20231220.sql

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ DECLARE
66
BEGIN
77
SELECT stage_two + 1 INTO next_version FROM schema_version ;
88
IF next_version = 34 THEN
9-
EXECUTE 'ALTER TABLE "committee_de_registration" ADD COLUMN "cold_key" bytea NOT NULL' ;
10-
EXECUTE 'ALTER TABLE "committee_de_registration" DROP COLUMN "hot_key"' ;
119
EXECUTE 'CREATe TABLE "off_chain_vote_data"("id" SERIAL8 PRIMARY KEY UNIQUE,"voting_anchor_id" INT8 NOT NULL,"hash" BYTEA NOT NULL,"json" jsonb NOT NULL,"bytes" bytea NOT NULL)' ;
12-
EXECUTE 'CREATe TABLE "off_chain_vote_fetch_error"("id" SERIAL8 PRIMARY KEY UNIQUE,"voting_anchor_id" INT8 NOT NULL,"fetch_error" VARCHAR NOT NULL,"fetch_time" timestamp NOT NULL,"retry_count" word31type NOT NULL)' ;
1310
EXECUTE 'ALTER TABLE "off_chain_vote_data" ADD CONSTRAINT "unique_off_chain_vote_data" UNIQUE("voting_anchor_id","hash")' ;
11+
EXECUTE 'CREATe TABLE "off_chain_vote_fetch_error"("id" SERIAL8 PRIMARY KEY UNIQUE,"voting_anchor_id" INT8 NOT NULL,"fetch_error" VARCHAR NOT NULL,"fetch_time" timestamp NOT NULL,"retry_count" word31type NOT NULL)' ;
1412
EXECUTE 'ALTER TABLE "off_chain_vote_fetch_error" ADD CONSTRAINT "unique_off_chain_vote_fetch_error" UNIQUE("voting_anchor_id","retry_count")' ;
1513
-- Hand written SQL statements can be added here.
1614
UPDATE schema_version SET stage_two = next_version ;

0 commit comments

Comments
 (0)