[GH-ISSUE #130] FOREIGN KEY #94

Open
opened 2026-02-25 21:33:14 +03:00 by kerem · 0 comments
Owner

Originally created by @flowerbling on GitHub (Jun 10, 2022).
Original GitHub issue: https://github.com/DBDiff/DBDiff/issues/130

sql
...
PRIMARY KEY (id),
FOREIGN KEY (logId) REFERENCES table_a(id)
...

...
PRIMARY KEY (id),
FOREIGN KEY (orderId) REFERENCES table_a(id)
...

#---------- UP ----------
ALTER TABLE xxx DROP CONSTRAINT ; ALTER TABLE `xxx` ADD CONSTRAINT `xxx_ibfk_1` FOREIGN KEY (`logId`) REFERENCES `xxx1` (`id`); ALTER TABLE `yyy` DROP CONSTRAINT ;
ALTER TABLE xxx ADD CONSTRAINT yyy_ibfk_1 FOREIGN KEY (orderId) REFERENCES yyy1 (id`);
#---------- DOWN ----------
ERROR 1064 (42000) at line 7: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CONSTRAINT ``' at line 1

Originally created by @flowerbling on GitHub (Jun 10, 2022). Original GitHub issue: https://github.com/DBDiff/DBDiff/issues/130 sql ... PRIMARY KEY (`id`), FOREIGN KEY (`logId`) REFERENCES `table_a`(`id`) ... ... PRIMARY KEY (`id`), FOREIGN KEY (`orderId`) REFERENCES `table_a`(`id`) ... #---------- UP ---------- ALTER TABLE `xxx` DROP CONSTRAINT ``; ALTER TABLE `xxx` ADD CONSTRAINT `xxx_ibfk_1` FOREIGN KEY (`logId`) REFERENCES `xxx1` (`id`); ALTER TABLE `yyy` DROP CONSTRAINT ``; ALTER TABLE `xxx` ADD CONSTRAINT `yyy_ibfk_1` FOREIGN KEY (`orderId`) REFERENCES yyy1` (`id`); #---------- DOWN ---------- ERROR 1064 (42000) at line 7: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CONSTRAINT ``' at line 1
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#94
No description provided.