mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Command orm:validate-schema doesn't take #[Table(schema: 'my_schema')] into account
#7023
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 @Aerendir on GitHub (Aug 12, 2022).
Bug Report
Summary
On PostgreSQL, when specifying the
schemain which to create the table, the commandorm:validate-schemaalways returns an error saying the schema is not in synch. Removing theschemaparameter from the attribute solves the problem and the command correctly says the schema is in sync.Version of PostgreSQL used: 12
Current behavior
Tested through Symfony, each time I run
symfony console doctrine:schema:validateit says the schema is not in sync.It started with this error around 2020/07 but I never put too much attention to the issue.
Now I have started to work again on the app and faced this issue again.
After many hours of debugging, I found that the problem is the
schemaproperty of theTableattribute/annotation.It seems the command doesn't take into account the schema when evaluating the syncing of the schema.
How to reproduce
#[Table(name: 'yuor_name', schema: 'a_custom_schema')]symfony console doctrine:database:createsymfony console doctrine:schema:createsymfony console doctrine:schema:validateThe error should appear.
Expected behavior
The command return
0(Success) as the database is correctly in synch.@aleho commented on GitHub (Aug 16, 2022):
I started having this issue with DBAL 3.4.0.
After a bit of debugging I was able to trace it to the
SEARCH_PATHimplementation.Apparently the comparator cannot handle search paths correctly if there are multiple schemas involved.
Changing the search path to all schemas involved breaks 3.3 and doesn't fix the issue on 3.4.
@aleho commented on GitHub (Aug 17, 2022):
@Aerendir Does
doctrine/dbal:^3.4.1solve this for you? Because for me it does.@Aerendir commented on GitHub (Aug 17, 2022):
@aleho , yes, it solved the issue for me, too! 🎉
Thank you for your support!