Skip to content

Commit

Permalink
Merge pull request #2113 from input-output-hk/djo/1957/remove_network…
Browse files Browse the repository at this point in the history
…_from_cardano_db_beacon_in_db

Add a database migration to remove `network` from cardano immutable files full beacons
  • Loading branch information
Alenar authored Nov 14, 2024
2 parents 85bc542 + b970fea commit 86abef9
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mithril-aggregator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mithril-aggregator"
version = "0.5.111"
version = "0.5.112"
description = "A Mithril Aggregator server"
authors = { workspace = true }
edition = { workspace = true }
Expand Down
20 changes: 20 additions & 0 deletions mithril-aggregator/src/database/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -827,5 +827,25 @@ update signed_entity
where signed_entity.signed_entity_type_id = 2;
"#,
),
// Migration 31
// Remove `network` from cardano immutable files full beacons in `open_message`,
// `signed_entity`, and `certificate` tables
SqlMigration::new(
31,
r#"
update open_message
set beacon = json_remove(beacon, '$.network')
where open_message.signed_entity_type_id = 2;
update signed_entity
set beacon = json_remove(beacon, '$.network'),
artifact = json_remove(artifact, '$.beacon.network')
where signed_entity.signed_entity_type_id = 2;
update certificate
set signed_entity_beacon = json_remove(signed_entity_beacon, '$.network')
where certificate.signed_entity_type_id = 2;
"#,
),
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ mod tests {
142,
'preview',
2,
'{"network":"preview","epoch":142,"immutable_file_number":2838}',
'{"epoch":142,"immutable_file_number":2838}',
'0.1.0',
'{"k":2422,"m":20973,"phi_f":0.2}',
'{"message_parts":{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ mod tests {
'bfcd77e372a25e13353bb77697d0d08785ba98b703e22640a317c5054dc05fb1',
2,
'258edf0f1238c60985d0229869a6d4c4c635c118915b4d524d2686515be99946',
'{"network":"preview","epoch":142,"immutable_file_number":2847}',
'{"epoch":142,"immutable_file_number":2847}',
'2023-05-09T13:11:15Z',
'{
"digest":"bfcd77e372a25e13353bb77697d0d08785ba98b703e22640a317c5054dc05fb1",
"network":"preview",
"beacon":{"network":"preview","epoch":142,"immutable_file_number":2847},
"beacon":{"epoch":142,"immutable_file_number":2847},
"size":1689696245,
"locations":["https://storage.googleapis.com/mithril-testing-preview-cs/preview-e142-i2847.bfcd77e372a25e13353bb77697d0d08785ba98b703e22640a317c5054dc05fb1.tar.gz"],
"compression_algorithm":"gzip",
Expand Down
2 changes: 1 addition & 1 deletion mithril-signer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mithril-signer"
version = "0.2.213"
version = "0.2.214"
description = "A Mithril Signer"
authors = { workspace = true }
edition = { workspace = true }
Expand Down
10 changes: 10 additions & 0 deletions mithril-signer/src/database/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,15 @@ create index signed_beacon_epoch on signed_beacon(epoch);
create index signed_beacon_signed_entity_type_id on signed_beacon(signed_entity_type_id);
",
),
// Migration 4
// Remove `network` from cardano immutable files full beacons in `signed_beacon` table
SqlMigration::new(
31,
r#"
update signed_beacon
set beacon = json_remove(beacon, '$.network')
where signed_beacon.signed_entity_type_id = 2;
"#,
),
]
}

0 comments on commit 86abef9

Please sign in to comment.