Skip to content

Commit 7f23c24

Browse files
authored
Merge pull request #864 from input-output-hk/jpraynaud/829-adapt-single-signature-store
Create/Migrate `single_signature` store
2 parents 8fb1df1 + 19251d9 commit 7f23c24

File tree

4 files changed

+580
-7
lines changed

4 files changed

+580
-7
lines changed

mithril-aggregator/src/database/migration.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,26 @@ create table signer_registration (
259259
);
260260
insert into signer_registration select * from signer_registration_temp order by ROWID asc;
261261
drop table signer_registration_temp;
262+
"#,
263+
),
264+
// Migration 9
265+
// Add the `single_signature` table and rename previous table to `single_signature_legacy`
266+
SqlMigration::new(
267+
9,
268+
r#"
269+
create table if not exists single_signature (key_hash text primary key, key json not null, value json not null);
270+
alter table single_signature rename to single_signature_legacy;
271+
create table single_signature (
272+
open_message_id text not null,
273+
signer_id text not null,
274+
registration_epoch_setting_id integer not null,
275+
lottery_indexes json not null,
276+
signature text not null,
277+
created_at text not null default current_timestamp,
278+
primary key (open_message_id, signer_id, registration_epoch_setting_id)
279+
foreign key (open_message_id) references open_message(open_message_id) on delete cascade
280+
foreign key (signer_id, registration_epoch_setting_id) references signer_registration(signer_id, epoch_setting_id)
281+
);
262282
"#,
263283
),
264284
]

mithril-aggregator/src/database/provider/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ mod open_message;
55
mod signed_entity;
66
mod signer;
77
mod signer_registration;
8+
mod single_signature;
89
mod stake_pool;
910

1011
pub use certificate::*;
@@ -13,4 +14,5 @@ pub use open_message::*;
1314
pub use signed_entity::*;
1415
pub use signer::*;
1516
pub use signer_registration::*;
17+
pub use single_signature::*;
1618
pub use stake_pool::*;

0 commit comments

Comments
 (0)