Bug: SQLite database being CLEARED every time after it failed to startup
Closed this issue · 1 comments
Describe the bug
SQLite database being cleared after it failed to startup.
I'm using Koishi and as you know it often break down, and in the next startup ALL MY DATA will be CLEARED, re-creating the tables with empty data. After the first time I lost my data, I began to make backups but it still couldn't solve the problem and my data is lost for several times.
I haven't tested on mysql or other drivers, but I think it's a sqlite specific problem.
Expected behavior
It should try to fix the database or at least refused to start to give me chance to backup data.
Versions
- Koishi version: 4.15.3
@koishijs/plugin-database-sqlite
version: 3.6.3
Additional context
Guess why I'm not using the latest version. EVERY TIME I upgrade the dependencies my app will failed to start and lead to a lot of problems. I think I will never use your stuffs again and I'm already migrating my app to other frameworks.
The SQLite driver uses emscripten under the hood, which has some issues when interacting with the local file system. So before 3.7.0, the driver was to load the database in memory every time, and in the worst case the file could be cleared.
Version 3.7.0 fixed this issue. Just one version above 3.6.3. I'm really sorry to hear your data being cleared.
EVERY TIME I upgrade the dependencies my app will failed to start and lead to a lot of problems.
I did not hear from you in any other issues. I know one related issue we have had, but it is fixed as well recently.
Thanks anyway for your report.