db.ts 466 B

1234567891011
  1. import { rm } from "fs/promises"
  2. import { Instance } from "../../src/project/instance"
  3. import { Database } from "../../src/storage/db"
  4. export async function resetDatabase() {
  5. await Instance.disposeAll().catch(() => undefined)
  6. Database.close()
  7. await rm(Database.Path, { force: true }).catch(() => undefined)
  8. await rm(`${Database.Path}-wal`, { force: true }).catch(() => undefined)
  9. await rm(`${Database.Path}-shm`, { force: true }).catch(() => undefined)
  10. }