Add static method to delete databases
With v0.2 we will have this api as an options for specifying a VFS:
import { IdbFs } from "@electric-sql/pglite";
const pg = new PGlite({
fs: new IdbFs("my-database")
})
We should add a delete static method to the VFS interface that deletes the database from the underlying storage:
import { IdbFs } from "@electric-sql/pglite";
IdbFs.delete('my-database')
Would also like a method to clear the database. For unit testing re-initializing pglite every test is too slow. I am using a query to drop all tables in my afterEach but would prefer a more deterministic method.
Would also like a method to clear the database. For unit testing re-initializing pglite every test is too slow. I am using a query to drop all tables in my
afterEachbut would prefer a more deterministic method.
@codewithcheese Probably a good option would be DROP DATABASE ... instead of the tables. But I don't think there's a way to switch databases in pglite atm.