mirror of
https://github.com/frappe/books.git
synced 2025-02-02 03:58:26 +00:00
fix: don't create copy if memory
This commit is contained in:
parent
2dd3f9dab4
commit
a89627e139
@ -63,10 +63,10 @@ export class DatabaseManager extends DatabaseDemuxBase {
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
await this.db!.close();
|
||||
await fs.copyFile(copyPath, dbPath);
|
||||
copyPath && (await fs.copyFile(copyPath, dbPath));
|
||||
throw err;
|
||||
} finally {
|
||||
await fs.unlink(copyPath);
|
||||
copyPath && (await fs.unlink(copyPath));
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,6 +154,10 @@ export class DatabaseManager extends DatabaseDemuxBase {
|
||||
|
||||
async #makeTempCopy() {
|
||||
const src = this.db!.dbPath;
|
||||
if (src === ':memory:') {
|
||||
return null;
|
||||
}
|
||||
|
||||
const dir = path.parse(src).dir;
|
||||
const dest = path.join(dir, '__premigratory_temp.db');
|
||||
await fs.copyFile(src, dest);
|
||||
|
@ -24,6 +24,10 @@ const defaultNumberSeriesMap = {
|
||||
} as Record<ModelNameEnum, string>;
|
||||
|
||||
async function execute(dm: DatabaseManager) {
|
||||
if (dm.db?.dbPath === ':memory:') {
|
||||
return;
|
||||
}
|
||||
|
||||
const sourceKnex = dm.db!.knex!;
|
||||
const version = (
|
||||
await sourceKnex('SingleValue')
|
||||
|
Loading…
x
Reference in New Issue
Block a user