How can I save my database to a user file when usi...
# squarelibraries
a
How can I save my database to a user file when using SQLDelight? I plan to have the working database saved inside AppData folder (for crash recovery etc.) and when the user requests it, copy the database to the save path to implement save operation.
s
I'm afk but there is a database folder inside
context.filesDir
that you can copy
a
Thanks! Sorry, I meant on desktop. e.g. on Windows I'm not sure I can copy the db file while it's being used. I know SQLite has a backup API that can be used for that but I read that SQLDelight doesn't support it
s
iteresting, i'm not very familiar with this. can you share more details about the backup api?
a
Oh, there's also
VACUUM INTO
apparently
r
This is only available from 3.27 version. Not sure whether SqlDelight uses sqlite 3.27