hemant1770
DTDrizzle Team
•Created by hemant1770 on 3/19/2024 in #help
Sqlite - Inserted rows do not get pushed from cache to the disk
I am using drizzle-sqlite in a svlete project. The project has db.ts that creates a new sqlite db on a local file and exports db like so:
export const db: BetterSQLite3Database<typeof schema> = drizzle(sqlite, {
// to use query builders like findMany()
schema,
});
where schema is in schema.ts (currently reduced to a single table with three columns of type text.
A test page has a form with a single button which on click inserts a bunch of records in the db
db.insert(mytable).values({....})
and another form with a single button which displays the records for the db.
db.query.mytable.findMany()
After insert, my query returns the rows inserted bu drizzle studio does not show them and after quitting and relaunching the app, the rows are not in the db. The sqlite db file also shows timestamp of before the insert operations. Seems that records were in the cache after the insert but never pushed to the disk.
Do I have to do anything special to make data persistent? Could it be anything in the config that would make data ephemeral?
Thanks for help.
3 replies