Created
May 26, 2011 21:34
-
-
Save amcclosky/994139 to your computer and use it in GitHub Desktop.
This will return a list of alter table statements which drop all foreign keys from the given database in MySQL. (via http://goo.gl/9ZD9N)
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_schema,'.',table_name,' DROP FOREIGN KEY ',constraint_name,';') from information_schema.table_constraints WHERE constraint_type='FOREIGN KEY' AND table_schema='<database_name>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment