Skip to content

Commit ecae254

Browse files
committed
chore: merge schema 5 into 4
This is safe because schema 4 has not yet been released
1 parent de84f53 commit ecae254

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

stacks-signer/src/signerdb.rs

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,6 @@ CREATE INDEX IF NOT EXISTS block_rejection_signer_addrs_on_block_signature_hash
326326

327327
static CREATE_INDEXES_4: &str = r#"
328328
CREATE INDEX IF NOT EXISTS blocks_state ON blocks ((json_extract(block_info, '$.state')));
329-
"#;
330-
331-
static CREATE_INDEXES_5: &str = r#"
332329
CREATE INDEX IF NOT EXISTS blocks_signed_group ON blocks ((json_extract(block_info, '$.signed_group')));
333330
"#;
334331

@@ -434,11 +431,6 @@ static SCHEMA_4: &[&str] = &[
434431
"INSERT OR REPLACE INTO db_config (version) VALUES (4);",
435432
];
436433

437-
static SCHEMA_5: &[&str] = &[
438-
CREATE_INDEXES_5,
439-
"INSERT OR REPLACE INTO db_config (version) VALUES (5);",
440-
];
441-
442434
impl SignerDb {
443435
/// The current schema version used in this build of the signer binary.
444436
pub const SCHEMA_VERSION: u32 = 4;
@@ -527,20 +519,6 @@ impl SignerDb {
527519
Ok(())
528520
}
529521

530-
/// Migrate from schema 4 to schema 5
531-
fn schema_5_migration(tx: &Transaction) -> Result<(), DBError> {
532-
if Self::get_schema_version(tx)? >= 5 {
533-
// no migration necessary
534-
return Ok(());
535-
}
536-
537-
for statement in SCHEMA_5.iter() {
538-
tx.execute_batch(statement)?;
539-
}
540-
541-
Ok(())
542-
}
543-
544522
/// Either instantiate a new database, or migrate an existing one
545523
/// If the detected version of the existing database is 0 (i.e., a pre-migration
546524
/// logic DB, the DB will be dropped).
@@ -553,8 +531,7 @@ impl SignerDb {
553531
1 => Self::schema_2_migration(&sql_tx)?,
554532
2 => Self::schema_3_migration(&sql_tx)?,
555533
3 => Self::schema_4_migration(&sql_tx)?,
556-
4 => Self::schema_5_migration(&sql_tx)?,
557-
5 => break,
534+
4 => break,
558535
x => return Err(DBError::Other(format!(
559536
"Database schema is newer than supported by this binary. Expected version = {}, Database version = {x}",
560537
Self::SCHEMA_VERSION,

0 commit comments

Comments
 (0)