Created
September 8, 2017 07:40
-
-
Save ragingprodigy/9891e8484ae7ea0267a041eb048fec02 to your computer and use it in GitHub Desktop.
Generate Queries to Delete all Foreign Keys from all tables in the current MySQL Database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT CONCAT("alter table ", TABLE_NAME," drop foreign key ", CONSTRAINT_NAME,"; ") AS runMe | |
FROM information_schema.key_column_usage | |
WHERE TABLE_SCHEMA=DATABASE() AND CONSTRAINT_NAME LIKE '%ibfk%'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment