I'm using SQLDelight in the Kotlin/Native project (iOS & Android), and I'm looking for the best way to drop DB (all tables).
User case: use log out from the app. So, I was looking for a way to erase data from all tables.
So far I tried this, but I don't have access to sqlite_master
table:
dropAllTables:
PRAGMA writable_schema = 1;
DELETE FROM sqlite_master WHERE type IN ('table', 'index', 'trigger');
PRAGMA writable_schema = 0;
VACUUM;
PRAGMA INTEGRITY_CHECK;
Error: No table found with name sqlite_master
What is the best way to drop all table with SQLDeligth
? (I want to avoid writing DROP TABLE
fro each table)
Also, upsert {
doesn't seems to work for me as well.. don't know how to provide label
for it .
If you don’t care about anything in the dB and want it completely cleared you can just close the connection and delete the file, next time a connection is opened it will recreate the db