diff --git a/package.json b/package.json index e86f2db..5460edc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ztimson/utils", - "version": "0.26.21", + "version": "0.26.22", "description": "Utility library", "author": "Zak Timson", "license": "MIT", diff --git a/src/database.ts b/src/database.ts index 52511e6..89e5739 100644 --- a/src/database.ts +++ b/src/database.ts @@ -100,9 +100,9 @@ export class Database { if(!this.includes(table.name)) { const newDb = new Database(this.database, [...this.tables, table], (this.version ?? 0) + 1); conn.close(); - await newDb.connection; - Object.assign(this, newDb); + this.connection = newDb.connection; await this.connection; + Object.assign(this, newDb); } return this.table(table.name); }); @@ -115,9 +115,9 @@ export class Database { const conn = await this.connection; const newDb = new Database(this.database, this.tables.filter(t => t.name != (table).name), (this.version ?? 0) + 1); conn.close(); - await newDb.connection; - Object.assign(this, newDb); + this.connection = newDb.connection; await this.connection; + Object.assign(this, newDb); }); }