Create the default namespace in the schema #11658
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch should address doctrine/migrations#1415.
Problem details
current_schema()
in theSchema
.SchemaTool
generates the schema to be deployed, it doesn't create the default namespace.As a result, we have a mismatch in the list of schemas between the "from" and "to" schemas.
Solution
Instead of the approach proposed in doctrine/dbal#5609, here, we add the default namespace obtain from the schema configuration, to the schema. This replicates the behavior of the schema manager.
Alternatives
As an option, the DBAL
Schema
could automatically create the namespace with the name from configuration in its constructor. There are certain difficulties with that:postgres
).createNamespace
with the same name (as the DBAL's schema manager does) will fail.Limitations
This fix cannot be implemented in ORM 2.x which still supports DBAL 3.x, which has the issue #2 from the above list.