foundry: ResetDatabase does not work with multiple schemas
[Version: 1.35]
We’re having issues with the ResetDatabase
trait ever since we introduced new schemas to our PostgreSQL database. (In addition to the default “public” scheme, that is.)
After a little digging I found that the issue lies with how the database is cleared in the ORMDatabaseResetter::dropSchema
method. The doctrine:schema:drop
command does not seem to drop the schemas, but doctrine:schema:create
tries to recreate them anyway in ORMDatabaseResetter::createSchema
, which throws an exception.
I can fix it (for me) by just executing the doctrine:schema:update
command instead, in ORMDatabaseResetter::createSchema
. I’m pretty sure this will work for non-postgres platforms as well.
About this issue
- Original URL
- State: open
- Created 10 months ago
- Comments: 18 (9 by maintainers)
I think it’s not related: #458 only kills active connections to the db in order to be able to drop the schema
I tested the
--full-database
option as well, but it did not remove the schemas for me either. It’s intended to also remove tables that are not managed by the entity manager (like migrations or messages)Yes, for me it now works using either the migrate reset mode, or using the schema reset mode with my fix.
Without the fix it throws an exception like
I’ll give it a shot 😃
Got it, thanks for the explanation! @nikophil, could this in anyway be related to #458/#455?
If swapping
doctrine:schema:create
withdoctrine:schema:update
works with all db platforms, I’m fine doing a straight-up replace. Could you create a PR so we can see if the test suite passes? This will at least test mysql/postgres.