@lobomfz/db 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/database.ts +4 -0
package/package.json
CHANGED
package/src/database.ts
CHANGED
|
@@ -365,8 +365,12 @@ export class Database<T extends SchemaRecord> {
|
|
|
365
365
|
reset(table?: keyof T & string): void {
|
|
366
366
|
const tables = table ? [table] : Object.keys(this.options.schema.tables);
|
|
367
367
|
|
|
368
|
+
this.sqlite.run("PRAGMA foreign_keys = OFF");
|
|
369
|
+
|
|
368
370
|
for (const t of tables) {
|
|
369
371
|
this.sqlite.run(`DELETE FROM "${t}"`);
|
|
370
372
|
}
|
|
373
|
+
|
|
374
|
+
this.sqlite.run("PRAGMA foreign_keys = ON");
|
|
371
375
|
}
|
|
372
376
|
}
|