[GH-ISSUE #48] Deleting foreign key constraints, wrong order and invalid syntax #31

Open
opened 2026-02-25 21:33:05 +03:00 by kerem · 1 comment
Owner

Originally created by @ptmrio on GitHub (May 15, 2017).
Original GitHub issue: https://github.com/DBDiff/DBDiff/issues/48

When deleting foreign key constraints, two error appear:

  1. DBDiff tries to delete the index key first and then to drop the constraint. But as MySQL still uses the constraints, it can't drop the key.

  2. Wrong Syntax for dropping the constraint, see: http://stackoverflow.com/questions/14122031/how-to-remove-constraints-from-my-mysql-table

Example: create two tables and add a foreign key, create dbdiff and see what' wrong.
ALTER TABLE order ADD FOREIGN KEY ( user_id ) REFERENCES user( id )

(great work else, love the script, helps me save a lot of time.)

Originally created by @ptmrio on GitHub (May 15, 2017). Original GitHub issue: https://github.com/DBDiff/DBDiff/issues/48 When deleting foreign key constraints, two error appear: 1) DBDiff tries to delete the index key first and then to drop the constraint. But as MySQL still uses the constraints, it can't drop the key. 2) Wrong Syntax for dropping the constraint, see: http://stackoverflow.com/questions/14122031/how-to-remove-constraints-from-my-mysql-table Example: create two tables and add a foreign key, create dbdiff and see what' wrong. `ALTER TABLE order ADD FOREIGN KEY ( user_id ) REFERENCES user( id ) ` (great work else, love the script, helps me save a lot of time.)
Author
Owner

@jasdeepkhalsa commented on GitHub (Nov 24, 2017):

Similar to Issue #41. We will clean this up as part of the same feature that solves #41

<!-- gh-comment-id:346853600 --> @jasdeepkhalsa commented on GitHub (Nov 24, 2017): Similar to Issue #41. We will clean this up as part of the same feature that solves #41
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/DBDiff#31
No description provided.