Skip to content

Commit

Permalink
Revert "sqlite: rename migration table"
Browse files Browse the repository at this point in the history
This reverts commit 244ce60.
  • Loading branch information
henrytill committed Jun 9, 2024
1 parent 09ec989 commit 808634f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/application/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,17 +353,17 @@ fn migrate(
} else if schema_version == SchemaVersion::new(1) {
let tx = connection.transaction()?;
{
tx.execute_batch("ALTER TABLE entries RENAME TO entries_v0")?;
tx.execute_batch("ALTER TABLE entries RENAME TO entries_v1")?;
tx.execute_batch(CREATE_TABLE)?;
let sql = "\
INSERT INTO entries
(id, keyid, timestamp, description, identity, ciphertext, meta)
SELECT id, ?1, timestamp, description, identity, ciphertext, meta
FROM entries_v0
FROM entries_v1
";
let mut stmt = tx.prepare(sql)?;
stmt.execute([config.key_id()])?;
tx.execute_batch("DROP TABLE entries_v0")?;
tx.execute_batch("DROP TABLE entries_v1")?;
}
tx.commit()?;
migrate(connection, config, SchemaVersion::new(2))
Expand Down

0 comments on commit 808634f

Please sign in to comment.