WatermelonDB
WatermelonDB copied to clipboard
fix:The database connection is not closed during the catch block
If this instance is not closed, it will result in the occupation of the database file.
When subsequent calls to setUpWithMigrations
or setUpWithSchema
reach the execution of unsafeDestroyEverything
,
https://github.com/Nozbe/WatermelonDB/blob/62774d5ebc4aa9ed6a2f61c8d4e795b32322cec6/src/adapters/sqlite/index.js#L144
https://github.com/Nozbe/WatermelonDB/blob/62774d5ebc4aa9ed6a2f61c8d4e795b32322cec6/src/adapters/sqlite/index.js#L195
Due to the old instance not closing the connection, even though the connection of the new instance is closed, an error resource busy or locked
still occurs when executing fs.unlinkSync
This fixes https://github.com/Nozbe/WatermelonDB/issues/1705
Thanks for the fix @KotoriMinami, but tests no longer pass after this