mirror of
https://github.com/frappe/books.git
synced 2025-02-02 12:08:27 +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) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
await this.db!.close();
|
await this.db!.close();
|
||||||
await fs.copyFile(copyPath, dbPath);
|
copyPath && (await fs.copyFile(copyPath, dbPath));
|
||||||
throw err;
|
throw err;
|
||||||
} finally {
|
} finally {
|
||||||
await fs.unlink(copyPath);
|
copyPath && (await fs.unlink(copyPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,6 +154,10 @@ export class DatabaseManager extends DatabaseDemuxBase {
|
|||||||
|
|
||||||
async #makeTempCopy() {
|
async #makeTempCopy() {
|
||||||
const src = this.db!.dbPath;
|
const src = this.db!.dbPath;
|
||||||
|
if (src === ':memory:') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const dir = path.parse(src).dir;
|
const dir = path.parse(src).dir;
|
||||||
const dest = path.join(dir, '__premigratory_temp.db');
|
const dest = path.join(dir, '__premigratory_temp.db');
|
||||||
await fs.copyFile(src, dest);
|
await fs.copyFile(src, dest);
|
||||||
|
@ -24,6 +24,10 @@ const defaultNumberSeriesMap = {
|
|||||||
} as Record<ModelNameEnum, string>;
|
} as Record<ModelNameEnum, string>;
|
||||||
|
|
||||||
async function execute(dm: DatabaseManager) {
|
async function execute(dm: DatabaseManager) {
|
||||||
|
if (dm.db?.dbPath === ':memory:') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const sourceKnex = dm.db!.knex!;
|
const sourceKnex = dm.db!.knex!;
|
||||||
const version = (
|
const version = (
|
||||||
await sourceKnex('SingleValue')
|
await sourceKnex('SingleValue')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user