Skip to content

Commit 7882370

Browse files
committed
Fix migration 'signer_registration' table
1 parent 130ccbe commit 7882370

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

mithril-aggregator/src/database/migration.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ create table open_message (
151151
// Migration 6
152152
// Add the `signer_registration` table and migration data from the previous
153153
// `verification_key` JSON format.
154+
// TODO: activate FK w/ signer table exists `foreign key (signer_id) references signer(signer_id)`
154155
SqlMigration::new(
155156
6,
156157
r#"
@@ -164,9 +165,7 @@ create table signer_registration (
164165
stake integer,
165166
created_at text not null default current_timestamp,
166167
primary key (epoch_setting_id, signer_id)
167-
-- TODO: activate FK w/ signer table exists
168-
-- foreign key (signer_id) references signer(signer_id)
169-
foreign key (epoch_setting_id) references epoch_settings(epoch_setting_id)
168+
foreign key (epoch_setting_id) references epoch_setting(epoch_setting_id)
170169
);
171170
create table if not exists verification_key (key_hash text primary key, key json not null, value json not null);
172171
insert into signer_registration (signer_id,

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -653,22 +653,16 @@ mod tests {
653653
}
654654

655655
#[test]
656-
fn get_signer_registration_record_by_signer_id_and_epoch() {
656+
fn get_signer_registration_record_by_signer_id() {
657657
let connection = Connection::open(":memory:").unwrap();
658658
let provider = SignerRegistrationRecordProvider::new(&connection);
659659
let condition = provider
660-
.condition_by_signer_id_and_epoch("signer-123".to_string(), &Epoch(1))
660+
.condition_by_signer_id("signer-123".to_string())
661661
.unwrap();
662662
let (filter, values) = condition.expand();
663663

664-
assert_eq!(
665-
"signer_id = ?1 and epoch_setting_id = ?2".to_string(),
666-
filter
667-
);
668-
assert_eq!(
669-
vec![Value::String("signer-123".to_string()), Value::Integer(1)],
670-
values
671-
);
664+
assert_eq!("signer_id = ?1".to_string(), filter);
665+
assert_eq!(vec![Value::String("signer-123".to_string())], values);
672666
}
673667

674668
#[test]

0 commit comments

Comments
 (0)