symfony - schema update with doctrine2 postgresql always DROPs and then ADDs CONSTRAINTs -


when updating schema, doctrine drops , add constraints. think, wrong...

php app/console doctrine:schema:update --force updating database schema... database schema updated successfully! "112" queries executed  php app/console doctrine:schema:update --dump-sql alter table table.managers drop constraint fk_677e81b7a76ed395; alter table table.managers add constraint fk_677e81b7a76ed395 foreign key (user_id) references table."user" (id) not deferrable immediate; ...  php app/console doctrine:schema:validate [mapping]  ok - mapping files correct. [database] fail - database schema not in sync current mapping file. 

how can may fixed?

after digging doctrine update schema methods, i've found issue. problem table names - "table.order" , "table.user". when doctrine makes diff, names become non equal, because of internal escaping (?). so, "user" != user, , foreign keys tables (order, user) recreating.

solution #1 - rename tables avoid name matching postgresql keywords, my_user, my_order. solution #2 - manually escape table names. not worked me, tried many different escaping ways.

i've applied solution #1 , see:

nothing update - database in sync current entity metadata


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -