Added the import/cleanup functionality
This commit is contained in:
@@ -715,6 +715,9 @@ pub fn run_import(
|
||||
PRAGMA foreign_keys = OFF;",
|
||||
)?;
|
||||
|
||||
// Wrap entire import in a transaction so interrupted imports don't leave empty tables
|
||||
conn.execute_batch("BEGIN;")?;
|
||||
|
||||
let mut stats = ImportStats::default();
|
||||
|
||||
// Import artists
|
||||
@@ -818,6 +821,9 @@ pub fn run_import(
|
||||
rusqlite::params![stats.recordings.to_string()],
|
||||
)?;
|
||||
|
||||
// Commit the transaction — if we got here, everything succeeded
|
||||
conn.execute_batch("COMMIT;")?;
|
||||
|
||||
progress(&format!("Import complete: {stats}"));
|
||||
Ok(stats)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user