Skip to content

Commit

Permalink
Don't create and upgrade sqlite for new users, bypass the entire sqli…
Browse files Browse the repository at this point in the history
…te history instead
  • Loading branch information
mikedilger committed Sep 27, 2023
1 parent ab87f38 commit 5534793
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/storage/import/legacy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ pub fn init_database() -> Result<Connection, Error> {
let connection = Connection::open_with_flags(
&db_path,
rusqlite::OpenFlags::SQLITE_OPEN_READ_WRITE
| rusqlite::OpenFlags::SQLITE_OPEN_CREATE
| rusqlite::OpenFlags::SQLITE_OPEN_NO_MUTEX
| rusqlite::OpenFlags::SQLITE_OPEN_NOFOLLOW,
)?;
Expand Down
12 changes: 11 additions & 1 deletion src/storage/import/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,17 @@ impl Storage {
let mut txn = self.env.write_txn()?;

// Progress the legacy database to the endpoint first
let mut db = legacy::init_database()?;
let mut db = match legacy::init_database() {
Ok(db) => db,
Err(_) => {
// Probably missing. Let's mock up default necessary data:
let settings: Settings1 = Default::default();
self.write_settings1(&settings, Some(&mut txn))?;
txn.commit()?;
self.sync()?;
return Ok(());
}
};
legacy::setup_database(&mut db)?;
tracing::info!("LDMB: setup");

Expand Down

0 comments on commit 5534793

Please sign in to comment.