Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doctrine:schema:drop does not remove custom schema in PostgreSQL #11701

Open
nikophil opened this issue Oct 26, 2024 · 3 comments · May be fixed by doctrine/dbal#6576
Open

doctrine:schema:drop does not remove custom schema in PostgreSQL #11701

nikophil opened this issue Oct 26, 2024 · 3 comments · May be fixed by doctrine/dbal#6576

Comments

@nikophil
Copy link

nikophil commented Oct 26, 2024

Bug Report

Q A
Version all

Summary

(sorry if the the error has already been reported, I've only found doctrine/DoctrineBundle#548 for which a user said it should be reopened)

Given we have an entity which declares a custom schema:

#[ORM\Entity]
#[ORM\Table(name: 'article', schema: 'custom')]

In PostgreSQL, doctrine:schema:create and doctrine:schema:update will create a "schema" named custom, next to the default public one.
But doctrine:schema:drop will not drop this newly created schema.

Current behavior

The following is creating an error:

$ bin/console doctrine:database:create
$ bin/console doctrine:schema:create -f
$ bin/console doctrine:schema:drop -f --full-database
$ bin/console doctrine:schema:create -f

Schema-Tool failed with Error 'An exception occurred while executing a query: SQLSTATE[42P06]: Duplicate schema: 7 ERROR: schema "custom" already exists' while executing DDL: CREATE SCHEMA custom

Expected behavior

I'd expect doctrine:schema:drop to emit a DROP SCHEMA custom.

Please, let me know if this is a bug or the desired behavior. I'd be happy to provide a fix.

@greg0ire
Copy link
Member

Hi, I think this is a bug. Just to be sure, you're using dbal 4, right?

@nikophil
Copy link
Author

Yes I do, but I'm pretty sure the problem did existe with dbal 3 and or orm 2
BTW should I provide a fix for both versions?

@greg0ire
Copy link
Member

If you can, please do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants