| 330 | use super::*; |
| 331 | |
| 332 | fn temp_db() -> Arc<redb::Database> { |
| 333 | let dir = tempfile::tempdir().unwrap(); |
| 334 | let path = dir.path().join("test.redb"); |
| 335 | let db = redb::Database::create(&path).unwrap(); |
| 336 | // Create the table. |
| 337 | let txn = db.begin_write().unwrap(); |
| 338 | { |
| 339 | let _ = txn.open_table(MigrationStateTable::TABLE).unwrap(); |
| 340 | } |
| 341 | txn.commit().unwrap(); |
| 342 | // Box keeps the TempDir alive — we leak it intentionally for tests. |
| 343 | std::mem::forget(dir); |
| 344 | Arc::new(db) |
| 345 | } |
| 346 | |
| 347 | fn make_row( |
| 348 | id: MigrationId, |