cordiverse / minato

Type Driven Database Framework.
MIT License
26 stars 12 forks source link

Bug: SQLite database being CLEARED every time after it failed to startup #55

Closed AsakuraMizu closed 10 months ago

AsakuraMizu commented 10 months ago

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

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.

shigma commented 10 months ago

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.