Sqlite db persistence


Heya, so i’ve checked out https://glitch.com/~sqlite3-db as an example of db persistence in glitch, but when my project sleeps the DB appears to reset. is there any way to prevent this so that my data stays in place even after a sleep?


If you’re using the SQLite code in an existing project rather than remixing, then you might need to create the .data directory for the db yourself. Just create a file called .data/temp.txt or something and then your database should be able to write to the file, which is persisted so isn’t lost when the project sleeps. Feel free to remove your temp file afterwards.

Otherwise, make sure you’re not using ‘force: true’ in the db setup code, as like the comment says - it will drop the existing table.


damn, i completely missed the force: true part. thanks a bunch!