Skip to content

Instantly share code, notes, and snippets.

@jbuck
Last active May 17, 2017 03:28
Show Gist options
  • Save jbuck/ef1c4b060efbb8b768a6e2409c6005b0 to your computer and use it in GitHub Desktop.
Save jbuck/ef1c4b060efbb8b768a6e2409c6005b0 to your computer and use it in GitHub Desktop.
SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';
+--------------------------+-------------------+
| Variable_name | Value |
+--------------------------+-------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| collation_connection | utf8_general_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
+--------------------------+-------------------+
# Where do we change these? RDS console?
select SPECIFIC_NAME, CHARACTER_SET_CLIENT, COLLATION_CONNECTION, DATABASE_COLLATION from routines where ROUTINE_SCHEMA = 'fxa';
+---------------------------------------+----------------------+----------------------+--------------------+
| SPECIFIC_NAME | CHARACTER_SET_CLIENT | COLLATION_CONNECTION | DATABASE_COLLATION |
+---------------------------------------+----------------------+----------------------+--------------------+
| accountDevices_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| accountDevices_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| accountDevices_3 | utf8 | utf8_general_ci | utf8_unicode_ci |
| accountDevices_4 | utf8 | utf8_general_ci | utf8_unicode_ci |
| accountDevices_5 | utf8 | utf8_general_ci | utf8_unicode_ci |
| accountDevices_6 | utf8 | utf8_general_ci | utf8_unicode_ci |
| accountEmails_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| accountExists_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| accountResetToken_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| account_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| account_3 | utf8 | utf8_general_ci | utf8_unicode_ci |
| ackPublishedEvents_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| checkPassword_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| consumeSigninCode_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| consumeUnblockCode_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createAccount_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createAccount_4 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createAccount_5 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createAccount_6 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createDevice_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createDevice_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createEmailBounce_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createEmail_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createKeyFetchToken_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createKeyFetchToken_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createPasswordChangeToken_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createPasswordForgotToken_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createSecurityEvent_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createSecurityEvent_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createSecurityEvent_3 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createSessionToken_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createSessionToken_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createSessionToken_3 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createSessionToken_4 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createSigninCode_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createUnblockCode_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createVerificationReminder_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| createVerificationReminder_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| dbMetadata_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deleteAccountResetToken_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deleteAccount_10 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deleteAccount_11 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deleteAccount_12 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deleteAccount_13 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deleteAccount_4 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deleteAccount_5 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deleteAccount_6 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deleteAccount_7 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deleteAccount_8 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deleteAccount_9 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deleteDevice_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deleteDevice_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deleteEmail_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deleteKeyFetchToken_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deleteKeyFetchToken_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deletePasswordChangeToken_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deletePasswordForgotToken_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deleteSessionToken_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deleteSessionToken_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deleteSessionToken_3 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deleteVerificationReminder_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| deviceFromTokenVerificationId_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| emailRecord_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| emailRecord_3 | utf8 | utf8_general_ci | utf8_unicode_ci |
| emailRecord_4 | utf8 | utf8_general_ci | utf8_unicode_ci |
| expireSigninCodes_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| fetchEmailBounces_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| fetchSecurityEvents_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| fetchVerificationReminders_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| fetchVerificationReminders_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| forgotPasswordVerified_4 | utf8 | utf8_general_ci | utf8_unicode_ci |
| forgotPasswordVerified_5 | utf8 | utf8_general_ci | utf8_unicode_ci |
| getSecondaryEmail_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| getUnpublishedEvents_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| keyFetchTokenWithVerificationStatus_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| keyFetchToken_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| lockAccount_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| passwordChangeToken_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| passwordChangeToken_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| passwordForgotToken_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| prune | utf8 | utf8_general_ci | utf8_unicode_ci |
| prune_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| resetAccount_4 | utf8 | utf8_general_ci | utf8_unicode_ci |
| resetAccount_5 | utf8 | utf8_general_ci | utf8_unicode_ci |
| resetAccount_6 | utf8 | utf8_general_ci | utf8_unicode_ci |
| resetAccount_7 | utf8 | utf8_general_ci | utf8_unicode_ci |
| resetAccount_8 | utf8 | utf8_general_ci | utf8_unicode_ci |
| sessions_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| sessions_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| sessionTokenWithVerificationStatus_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| sessionTokenWithVerificationStatus_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| sessionToken_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| sessionToken_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| sessionToken_3 | utf8 | utf8_general_ci | utf8_unicode_ci |
| sessionWithDevice_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| sessionWithDevice_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| sessionWithDevice_3 | utf8 | utf8_general_ci | utf8_unicode_ci |
| sessionWithDevice_4 | utf8 | utf8_general_ci | utf8_unicode_ci |
| unlockAccount_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| unlockCode_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| updateDevice_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| updateDevice_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| updateLocale_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| updatePasswordForgotToken_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| updateSessionToken_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| upsertDevice_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| verifyEmail_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| verifyEmail_3 | utf8 | utf8_general_ci | utf8_unicode_ci |
| verifyEmail_4 | utf8 | utf8_general_ci | utf8_unicode_ci |
| verifyToken_1 | utf8 | utf8_general_ci | utf8_unicode_ci |
| verifyToken_2 | utf8 | utf8_general_ci | utf8_unicode_ci |
| verifyToken_3 | utf8 | utf8_general_ci | utf8_unicode_ci |
+---------------------------------------+----------------------+----------------------+--------------------+
112 rows in set (0.00 sec)
# We need to recreate all stored procedures
SET NAMES utf8mb4 COLLATE utf8mb4_bin;
USE fxa;
ALTER DATABASE fxa CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin;
ALTER TABLE accountResetTokens CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
ALTER TABLE accounts CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
ALTER TABLE accounts MODIFY COLUMN normalizedEmail VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL;
ALTER TABLE accounts MODIFY COLUMN email VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL;
ALTER TABLE accounts MODIFY COLUMN locale VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL;
ALTER TABLE dbMetadata CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
ALTER TABLE dbMetadata MODIFY COLUMN name VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL;
ALTER TABLE dbMetadata MODIFY COLUMN value VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL;
ALTER TABLE devices CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
ALTER TABLE devices MODIFY COLUMN name VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL;
ALTER TABLE devices MODIFY COLUMN type VARCHAR(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL;
ALTER TABLE devices MODIFY COLUMN callbackURL VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL;
ALTER TABLE emailBounces CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
ALTER TABLE emailBounces MODIFY COLUMN email VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL;
ALTER TABLE emails CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
ALTER TABLE emails MODIFY COLUMN normalizedEmail VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
ALTER TABLE emails MODIFY COLUMN email VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
ALTER TABLE keyFetchTokens CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
ALTER TABLE passwordChangeTokens CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
ALTER TABLE passwordForgotTokens CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
ALTER TABLE securityEventNames CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
ALTER TABLE securityEventNames MODIFY COLUMN name VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
ALTER TABLE securityEvents CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
ALTER TABLE sessionTokens CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
ALTER TABLE sessionTokens MODIFY COLUMN uaBrowser VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL;
ALTER TABLE sessionTokens MODIFY COLUMN uaBrowserVersion VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL;
ALTER TABLE sessionTokens MODIFY COLUMN uaOS VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL;
ALTER TABLE sessionTokens MODIFY COLUMN uaOSVersion VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL;
ALTER TABLE sessionTokens MODIFY COLUMN uaDeviceType VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL;
ALTER TABLE signinCodes CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
ALTER TABLE unblockCodes CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
ALTER TABLE unverifiedTokens CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
ALTER TABLE verificationReminders CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
ALTER TABLE verificationReminders MODIFY COLUMN type VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
REPAIR TABLE accountResetTokens; OPTIMIZE TABLE accountResetTokens;
REPAIR TABLE accounts; OPTIMIZE TABLE accounts;
REPAIR TABLE dbMetadata; OPTIMIZE TABLE dbMetadata;
REPAIR TABLE devices; OPTIMIZE TABLE devices;
REPAIR TABLE emailBounces; OPTIMIZE TABLE emailBounces;
REPAIR TABLE emails; OPTIMIZE TABLE emails;
REPAIR TABLE keyFetchTokens; OPTIMIZE TABLE keyFetchTokens;
REPAIR TABLE passwordChangeTokens; OPTIMIZE TABLE passwordChangeTokens;
REPAIR TABLE passwordForgotTokens; OPTIMIZE TABLE passwordForgotTokens;
REPAIR TABLE securityEventNames; OPTIMIZE TABLE securityEventNames;
REPAIR TABLE securityEvents; OPTIMIZE TABLE securityEvents;
REPAIR TABLE sessionTokens; OPTIMIZE TABLE sessionTokens;
REPAIR TABLE signinCodes; OPTIMIZE TABLE signinCodes;
REPAIR TABLE unblockCodes; OPTIMIZE TABLE unblockCodes;
REPAIR TABLE unverifiedTokens; OPTIMIZE TABLE unverifiedTokens;
REPAIR TABLE verificationReminders; OPTIMIZE TABLE verificationReminders;
USE fxa_oauth;
ALTER DATABASE fxa_oauth CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin;
ALTER TABLE clientDevelopers CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE clients CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE clients MODIFY COLUMN name VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
ALTER TABLE clients MODIFY COLUMN imageUri VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
ALTER TABLE clients MODIFY COLUMN redirectUri VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
ALTER TABLE codes CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE codes MODIFY COLUMN email VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
ALTER TABLE codes MODIFY COLUMN scope VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
ALTER TABLE dbMetadata CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE dbMetadata MODIFY COLUMN name VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL;
ALTER TABLE dbMetadata MODIFY COLUMN value VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL;
ALTER TABLE developers CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE developers MODIFY COLUMN email VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
ALTER TABLE refreshTokens CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE refreshTokens MODIFY COLUMN email VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
ALTER TABLE refreshTokens MODIFY COLUMN scope VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
ALTER TABLE tokens CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE tokens MODIFY COLUMN email VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
ALTER TABLE tokens MODIFY COLUMN type VARCHAR(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
ALTER TABLE tokens MODIFY COLUMN scope VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
REPAIR TABLE clientDevelopers; OPTIMIZE TABLE clientDevelopers;
REPAIR TABLE clients; OPTIMIZE TABLE clients;
REPAIR TABLE codes; OPTIMIZE TABLE codes;
REPAIR TABLE dbMetadata; OPTIMIZE TABLE dbMetadata;
REPAIR TABLE developers; OPTIMIZE TABLE developers;
REPAIR TABLE refreshTokens; OPTIMIZE TABLE refreshTokens;
REPAIR TABLE tokens; OPTIMIZE TABLE tokens;
USE fxa_profile;
ALTER DATABASE fxa_profile CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin;
ALTER TABLE avatar_providers CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE avatar_providers MODIFY COLUMN name VARCHAR(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
ALTER TABLE avatar_selected CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE avatars CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE avatars MODIFY COLUMN url VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
ALTER TABLE dbMetadata CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE dbMetadata MODIFY COLUMN name VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL;
ALTER TABLE dbMetadata MODIFY COLUMN value VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL;
ALTER TABLE profile CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE profile MODIFY COLUMN displayName VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL;
REPAIR TABLE avatar_providers; OPTIMIZE TABLE avatar_providers;
REPAIR TABLE avatar_selected; OPTIMIZE TABLE avatar_selected;
REPAIR TABLE avatars; OPTIMIZE TABLE avatars;
REPAIR TABLE dbMetadata; OPTIMIZE TABLE dbMetadata;
REPAIR TABLE profile; OPTIMIZE TABLE profile;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment