bigpresh/Dancer-Plugin-Database

Shutdown the Plugin (to free database)

mikkoi opened this issue · 0 comments

My use in testing:
I have PostgreSQL database and I test my Dancer2 API routes by creating a new database instance every time. That way I always get 1) completely fresh database and 2) the newest schema. When the test has been run and assuming there were no errors, the database is deleted. When I start my Dancer2 with Plack::Test, I also run a setup() function to give the database name to Dancer (via runtime config).

When I finish running the test, I cannot delete the database because it is still open and reserved by Dancer2.

I think, what we need, is a way to signal to Database plugin that it must close down the connection and keep it closed. Something like

database->abandon([name]);