Skip to content

Commit 9a80ded

Browse files
committed
Fix open message migration
1 parent 0c5aff3 commit 9a80ded

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

mithril-aggregator/src/database/migration.rs

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -282,26 +282,14 @@ create table single_signature (
282282
"#,
283283
),
284284
// Migration 10
285-
// Add the single signatures attached to the open messages. This table
286-
// does not have a previous existence so no data migration is needed.
285+
// Alter `open_message` table and drop `single_signature_legacy` table
287286
SqlMigration::new(
288287
10,
289288
r#"
290-
create table new_open_message (
291-
open_message_id text not null,
292-
epoch_setting_id int not null,
293-
beacon json not null,
294-
signed_entity_type_id int not null,
295-
protocol_message json not null,
296-
is_certified bool not null default false,
297-
created_at text not null default current_timestamp,
298-
primary key (open_message_id),
299-
foreign key (epoch_setting_id) references epoch_setting (epoch_setting_id),
300-
foreign key (signed_entity_type_id) references signed_entity_type (signed_entity_type_id)
301-
);
302-
alter table open_message rename to old_open_message;
303-
alter table new_open_message rename to open_message;
304-
drop table old_open_message;
289+
drop table single_signature_legacy;
290+
alter table open_message drop column message;
291+
alter table open_message add column protocol_message json not null;
292+
alter table open_message add column is_certified bool not null default false;
305293
"#,
306294
),
307295
]

0 commit comments

Comments
 (0)