mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
doctrine:database:drop --force for PostgreSQL #7138
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @benblub on GitHub (Apr 19, 2023).
The command doesn't work, even with the force option if some connection is open (postgreSQL). As example you have a opened connection with your DB Tool or the EntityManager has not closed a connection (can be happen while running tests)
https://www.postgresql.org/docs/current/sql-dropdatabase.html
Shows a force option but
doctrine:database:drop --forcedoesn't use the force option from postreSQL?you need to be a superuser but that should not be the problem
Related
https://github.com/zenstruck/foundry/issues/455
https://github.com/zenstruck/foundry/issues/72
@ostrolucky commented on GitHub (Apr 19, 2023):
Moved to orm repository, since core of the command is there
@Aweptimum commented on GitHub (Apr 19, 2023):
WITH (Force)was added in PG 13 and doctrine supports a minimum version of 9.4, so it'd break projects using a version less than 13 to use that syntax.To add this would probably require creating a new Postgres13 platform in DBAL that overrides
getDropDatabaseSQLto use the new syntax. For lesser versions, there is this 3-statement procedure here which could be put in the 9.4 platform'sgetDropDatabaseSQLif it wouldn't error. The SQL returned from that method is passed toConnection->executeStatement()which would complain about trying to execute multiple statements.In the meantime, you can create your own custom PG13 platform that extends from 10, overrides
getDropDatabaseSQL, and configure your project to use it