mirror of
https://github.com/chrisbenincasa/tunarr
synced 2026-04-21 13:37:15 +00:00
fix: manually trigger temp db migration file cleanup
otherwise it wont happen until exit
This commit is contained in:
parent
9410efac7a
commit
2c7fa22921
1 changed files with 2 additions and 1 deletions
|
|
@ -23,7 +23,7 @@ export class DatabaseCopyMigrator {
|
|||
constructor(private dbAccess: DBAccess) {}
|
||||
|
||||
async migrate(currentDbPath: string, migrateTo?: string) {
|
||||
const { path: tmpPath } = await tmp.file({ keep: false });
|
||||
const { path: tmpPath, cleanup } = await tmp.file({ keep: false });
|
||||
this.logger.debug('Migrating to temp DB %s', tmpPath);
|
||||
const tempDBConn = this.dbAccess.getOrCreateConnection(tmpPath);
|
||||
const tempDB = tempDBConn.kysely;
|
||||
|
|
@ -79,6 +79,7 @@ export class DatabaseCopyMigrator {
|
|||
await this.dbAccess.closeConnection(tmpPath);
|
||||
await this.dbAccess.closeConnection(currentDbPath);
|
||||
await fs.cp(tmpPath, currentDbPath);
|
||||
await cleanup();
|
||||
// Force reinit at the new path
|
||||
this.dbAccess.setConnection(currentDbPath);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue