Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2.3
-
Fix Version/s: None
-
Component/s: Migrations
-
Labels:None
Description
That's my relevant schema.yml before changes:
Customer:
columns:
[..]
CustomerPlace:
columns:
[..]
relations:
Customer:
local: customer_id
foreignAlias: Addresses
onDelete: CASCADE
CustomerPerson:
columns:
[..]
relations:
CustomerPlace:
local: place_id
foreignAlias: Contacts
onDelete: CASCADE
I deleted all of the 3 entities, I executed symfony doctrine:generate-migrations-diff, which created the migration file containing:
$this->dropTable('customer');
$this->dropTable('customer_person');
$this->dropTable('customer_place');
Executing the migration, gave me error for constrain violation. To fix the error, I added:
$this->dropForeignKey('customer_person', 'customer_person_place_id_customer_place_id'); $this->dropForeignKey('customer_place', 'customer_place_customer_id_customer_id');
Thanks.
Another way for fixing this issue, could be to generate a migration class for each of the related tables, so they are executed in different transaction, so integrity constrains aren't violated.