Skip to content

Commit 083d302

Browse files
committed
Fix Committee keys size
Fixes #1543
1 parent 6cd37a3 commit 083d302

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

cardano-db/src/Cardano/Db/Schema.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -557,13 +557,13 @@ share
557557
CommitteeRegistration
558558
txId TxId noreference
559559
certIndex Word16
560-
coldKey ByteString sqltype=addr29type
561-
hotKey ByteString sqltype=addr29type
560+
coldKey ByteString sqltype=bytea
561+
hotKey ByteString sqltype=bytea
562562

563563
CommitteeDeRegistration
564564
txId TxId noreference
565565
certIndex Word16
566-
hotKey ByteString sqltype=addr29type
566+
hotKey ByteString sqltype=bytea
567567

568568
DrepRegistration
569569
txId TxId noreference

schema/migration-2-0029-20231009.sql

+21
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 = 29 THEN
9+
ALTER TABLE committee_registration ALTER COLUMN cold_key SET DATA TYPE bytea;
10+
ALTER TABLE committee_registration ALTER COLUMN hot_key SET DATA TYPE bytea;
11+
ALTER TABLE committee_de_registration ALTER COLUMN hot_key SET DATA TYPE bytea;
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)