Last active
August 3, 2018 14:31
-
-
Save matdave/7617ac74c0a61e72be72a3a5d111874c to your computer and use it in GitHub Desktop.
Change Prefix to MODX in MySQL
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
/* Drop MODX */ | |
SELECT CONCAT( 'DROP TABLE ', GROUP_CONCAT(table_name) , ';' ) | |
AS statement FROM information_schema.TABLES WHERE table_schema = 'instance_cXXXX_modx' AND table_name LIKE 'modx_%'; | |
/* Change incorrect prefix */ | |
SELECT CONCAT( 'RENAME TABLE ', TABLE_NAME, ' TO ', replace(TABLE_NAME, 'wrong_', 'modx_'), ';') | |
AS statement FROM information_schema.TABLES WHERE table_schema = 'instance_cXXXX_modx' AND table_name LIKE 'wrong_%'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment