Skip to content

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

Open
doctrine/dbal
#6576
@nikophil

Description

@nikophil

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions