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

Fix DropSchemaObjectsSQLBuilder issues #5604

Merged
merged 2 commits into from Aug 21, 2022

Conversation

morozov
Copy link
Member

@morozov morozov commented Aug 20, 2022

  1. Although CreateSchemaSqlCollector creates the namespaces declared in the schema, DropSchemaObjectsSQLBuilder does not drop them. We will keep it the same in DropSchemaObjectsSQLBuilder for backward compatibility.
  2. When dropping a schema, the DBAL explicitly drops all schema sequences, even if they are owned by one of the tables being dropped. As a workaround for the regression, we will drop sequences first, which is how it is implemented in DropSchemaSqlCollector.

The newly added testDropWithAutoincrement() is intended to test the second issue but covers the first one as well. It would fail without the corresponding fix if run as part of the test suite.

Fixes #5598.
Closes #5600.

Although `CreateSchemaSqlCollector` creates the namespaces declared
in the schema, `DropSchemaObjectsSQLBuilder` does not drop them.

We will keep it the same in `DropSchemaObjectsSQLBuilder` for backward
compatibility.
@morozov morozov changed the title When dropping schema, drop sequences before tables Fix DropSchemaObjectsSQLBuilder issues Aug 20, 2022
When dropping a schema, the DBAL explicitly drops all schema sequences,
even if they are owned by one of the tables being dropped.

As a workaround for the regression, we will drop sequences first,
which is how it is implemented in `DropSchemaSqlCollector`.

Co-authored-by: HypeMC <hypemc@gmail.com>
@morozov morozov marked this pull request as ready for review August 20, 2022 23:37
@morozov morozov added this to the 3.4.2 milestone Aug 20, 2022
@morozov morozov merged commit 22de295 into doctrine:3.4.x Aug 21, 2022
@morozov morozov deleted the issues/5598-drop-sequence branch August 21, 2022 14:21
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Version 3.4.1 & the ORM SchemaTool doctrine:schema:drop --full-database drops "public" schema of PostgreSQL
2 participants