DoctrineBundle: [Bug][Postgres] SQLs generated via schema update changes nothing
Hi!
Recently I updated to symfony 5 and it comes version 2.0.0 of doctrine/doctrine-bundle, it seems that 2.0.0 version generates SQLs changes that that changes nothing.
I have following mapping for product entity
<entity name="Acme\Entity\Product" table="products">
<id name="id" column="id" type="product_id">
<generator strategy="NONE"/>
</id>
<many-to-one field="category" target-entity="Acme\Entity\Category">
<join-column name="category_id" nullable="false"/>
</many-to-one>
</entity>
When I run doctrine:schema:update --dump-sql it dumps following sql
ALTER TABLE products ALTER id TYPE UUID;
ALTER TABLE products ALTER id DROP DEFAULT;
ALTER TABLE products ALTER category_id TYPE UUID;
ALTER TABLE products ALTER category_id DROP DEFAULT;
Columns id and category_id already have type UUID with NOT NULL values. If I run doctrine:schema:update --force to execute those queries and again check for new queries by doctrine:schema:update --dump-sql those queries are still there.
It’s quiet annoying behavior because I use doctrine migrations bundle and even if there is no changes in schema it generates migrations that changes nothing. If want to generate migration that should change schema it mixes those those sqls that does nothing with real migration sqls.
Any ideas what changes in 2.0.0 version could cause this issue?
Postgres version: 11.5
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (11 by maintainers)
The
requiresSQLCommentHint
deprecation already happened in 1.11, but due to versioning in the pack it could happen that users jump from 1.6.10 (the minimum version required in the pack) straight to 2.0, bypassing the entire deprecation layer. Please limit the DoctrineBundle dependency to ^1.12 and fix deprecations before allowing to install 2.0.I’ve created symfony/orm-pack#18 to discuss how this can be avoided in the future - feedback in that issue would be greatly appreciated.
Yes, I do use custom types, I checked UPGRADE file - I do not mark types as commented in doctrine config, before I used version 1.11.2 and it was working fine. I’ll try to downgrade to 1.x and will try to spot what changes cause this issue.