2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 19:39:07 +00:00

fix: update prestiege to drop temp table if exists

This commit is contained in:
18alantom 2022-01-10 15:05:29 +05:30
parent 490837a5e1
commit 77d7ce3531

View File

@ -107,6 +107,7 @@ class SqliteDatabase extends Database {
async prestigeTheTable(tableName, tableRows) {
// Alter table hacx for sqlite in case of schema change.
const tempName = `__${tableName}`;
await this.knex.schema.dropTableIfExists(tempName);
await this.knex.raw('PRAGMA foreign_keys=OFF');
await this.createTable(tableName, tempName);
await this.knex.batchInsert(tempName, tableRows);