V
V
Vadim Ivanenko2014-12-14 14:30:39
MySQL
Vadim Ivanenko, 2014-12-14 14:30:39

Why does schema-tool:update try to replace existing foreign keys with its own?

I have a FK in the DB with On Update = CASCADE, On Remove = CASCADE and the names given to them. Entities and annotations were generated using the same utility (doctrine-module orm:). When updating the database structure with a utility, the doctrine wants to replace my FKs with its own (changing the name and removing the cascade of update and delete operations).

ALTER TABLE patient DROP FOREIGN KEY fk_patient_category1;
ALTER TABLE patient DROP FOREIGN KEY fk_patient_medcard1;
ALTER TABLE patient CHANGE medcard_id medcard_id INT DEFAULT NULL;
ALTER TABLE patient ADD CONSTRAINT FK_1ADAD7EB12469DE2 FOREIGN KEY (category_id) REFERENCES category (id);
ALTER TABLE patient ADD CONSTRAINT FK_1ADAD7EB5266C842 FOREIGN KEY (medcard_id) REFERENCES medcard (id);

How to make doctrine ignore updating foreign keys when doing schema-tool:update ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question