Unable to delete all rows from SQLite using Transactions?
i have a route
api/delete-all
that looks like:
i want to delete all values but i get a SQLITE_CONSTRAINT_ERROR
:
how do i delete all rows in a table?
i tried without transactions as well as using await tx.delete(users).all()
but it doesn't delete from the database.
i'm using https://turso.tech for sqlite on the edge.Turso | SQLite Developer Experience in an Edge Database
Eliminate application bottlenecks by bringing the performance and data portability of open source, lightweight SQL close to your users with low overhead
1 Reply
this one got solved. got the solution on turso discord. i had to either use
on delete cascade
or the order of deleting had to be such that leaf nodes get deleted first & then its parent nodes so no conflicts occur.
i went with this: