Rory-Reid / Basemix

An application for UK rat breeders
https://basemix.app
MIT License
0 stars 0 forks source link

Use sqlite backup API #39

Open Rory-Reid opened 9 months ago

Rory-Reid commented 9 months ago

Currently I backup the database by directly copying the hot database file to a new location.

This is probably okay for now since Basemix does nothing in the background, "closes the connection" after each operation, and you have to go out of your way to manually backup the db.

But.

Sqlite has a Backup API which is designed to safely let you backup the database while it is in usage.

Rory-Reid commented 9 months ago

The good news is the dotnet provider has a backup command: https://learn.microsoft.com/en-us/dotnet/standard/data/sqlite/backup

The bad news is that, actually, this doesn't use the "incremental backup API", but it is safer so I should move to it.

Provider issue is at: https://github.com/dotnet/efcore/issues/13834 and as someone points out - this probably works best where concurrent access isnt typical like in desktop apps.