Bug #87784 mysqldiff dropping foreign key constraints and adding them again wrongly
| Submitted: | 17 Sep 2017 7:40 | Modified: | 18 Sep 2017 5:57 |
|---|---|---|---|
| Reporter: | LOKESH SANAPALLI | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Utilities | Severity: | S2 (Serious) |
| Version: | 1.6.5 | OS: | Ubuntu (14.04) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | mysqldiff | ||
[17 Sep 2017 7:40]
LOKESH SANAPALLI
[18 Sep 2017 5:57]
MySQL Verification Team
Hello LOKESH, Thank you for the report and feedback. Thanks, Umesh
[5 Oct 2017 18:29]
carlos carlos
Also ignore ON DELETE and ON UPDATE # ON DB1 CREATE TABLE `user` ( `id` int(10) UNSIGNED NOT NULL, `name` varchar(100) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; CREATE TABLE `document` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `userId` int(10) UNSIGNED NOT NULL, `document` varchar(100) NOT NULL, PRIMARY KEY (`id`), KEY `userId` (`userId`), CONSTRAINT `document_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; #ON DB2 CREATE TABLE `user` ( `id` int(10) UNSIGNED NOT NULL, `name` varchar(100) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; CREATE TABLE `document` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `userId` int(10) UNSIGNED NOT NULL, `document` varchar(100) NOT NULL, PRIMARY KEY (`id`), KEY `userId` (`userId`), CONSTRAINT `document_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; mysqldiff --server1=root@localhost --server2=root@localhost --difftype=sql --changes-for=server1 --show-reverse db2.document:db1.document # WARNING: Using a password on the command line interface can be insecure. # server1 on localhost: ... connected. # server2 on localhost: ... connected. # Comparing db2.document to db1.document [FAIL] # Transformation for --changes-for=server1: # ALTER TABLE `db2`.`document` DROP FOREIGN KEY document_ibfk_1, ADD CONSTRAINT document_ibfk_1 FOREIGN KEY(userId) REFERENCES `db1`.`user`(id); # # Transformation for reverse changes (--changes-for=server2): # # ALTER TABLE `db1`.`document` # DROP FOREIGN KEY document_ibfk_1, # ADD CONSTRAINT document_ibfk_1 FOREIGN KEY(userId) REFERENCES `db2`.`user`(id); #
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.