Hi
I like to develop my db schema as I develop the code - TDD-style. So I need to keep dropping the database each and every time I need to update the schema and rerun the code. The problem is that even though I close the connection using #ensure: the reference remains and I cannot delete the database file immediately.
buildSchema | fp | (fp := self dbFilePath asFileReference) exists ifTrue: [ fp delete ]. [ self db beginTransaction. self writeSchema; writeData. self db commitTransaction ] ensure: [ self cleanUp ]I even tried running this before everything else to no avail:
SQLite3Connection allInstancesDo: [ :each | each close ].SmalltalkImage cleanUp.SmalltalkImage current garbageCollect.I keep getting a #CannotDeleteFileException because there is still a reference to the database file. If I do wait a seemingly random amount of time, the reference is cleared.
How can I get the VM to release the reference to the database file immediately?
Pharo 8/64-bit, Windows 10
Regards, Vince