Last active
April 27, 2018 03:08
-
-
Save oojacoboo/26f4439e740a3cbd890e48501e3fb6e4 to your computer and use it in GitHub Desktop.
MODIFY COLUMN to varchar(191) from varchar(255) for utfbmb4
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, '` ', | |
GROUP_CONCAT(CONCAT('MODIFY COLUMN `', COLUMN_NAME, '` VARCHAR(191)')), ';') AS _alter | |
FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE TABLE_SCHEMA = 'mydatabase' | |
AND COLUMN_TYPE LIKE 'VARCHAR%' | |
AND CHARACTER_MAXIMUM_LENGTH = 255 | |
AND CHARACTER_SET_NAME = 'utf8mb4' | |
GROUP BY TABLE_SCHEMA, TABLE_NAME; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment