Open KotoriMinami opened 1 year ago
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
setUpWithMigrations
setUpWithSchema
unsafeDestroyEverything
resource busy or locked
fs.unlinkSync
This fixes https://github.com/Nozbe/WatermelonDB/issues/1705
Thanks for the fix @KotoriMinami, but tests no longer pass after this
If this instance is not closed, it will result in the occupation of the database file.
When subsequent calls to
setUpWithMigrations
orsetUpWithSchema
reach the execution ofunsafeDestroyEverything
, 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 errorresource busy or locked
still occurs when executingfs.unlinkSync
This fixes https://github.com/Nozbe/WatermelonDB/issues/1705