Created
October 28, 2016 07:50
-
-
Save SimonJThompson/5d03af85c2deb87d451228b5d665545a to your computer and use it in GitHub Desktop.
Switch WP collations to utf8_unicode_ci
This file contains 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
# wp_posts | |
CREATE TABLE `wp_posts_temp` ( | |
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`post_author` bigint(20) unsigned NOT NULL DEFAULT '0', | |
`post_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', | |
`post_date_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', | |
`post_content` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, | |
`post_title` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, | |
`post_excerpt` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, | |
`post_status` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'publish', | |
`comment_status` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'open', | |
`ping_status` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'open', | |
`post_password` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', | |
`post_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', | |
`to_ping` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, | |
`pinged` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, | |
`post_modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', | |
`post_modified_gmt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', | |
`post_content_filtered` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, | |
`post_parent` bigint(20) unsigned NOT NULL DEFAULT '0', | |
`guid` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', | |
`menu_order` int(11) NOT NULL DEFAULT '0', | |
`post_type` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'post', | |
`post_mime_type` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', | |
`comment_count` bigint(20) NOT NULL DEFAULT '0', | |
PRIMARY KEY (`ID`), | |
KEY `post_name` (`post_name`(191)), | |
KEY `type_status_date` (`post_type`,`post_status`,`post_date`,`ID`), | |
KEY `post_parent` (`post_parent`), | |
KEY `post_author` (`post_author`) | |
) ENGINE=InnoDB AUTO_INCREMENT=158239 DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci; | |
INSERT INTO wp_posts_temp SELECT * FROM wp_posts; | |
RENAME TABLE wp_posts TO wp_posts_old; | |
RENAME TABLE wp_posts_temp TO wp_posts; | |
# wp_postmeta | |
CREATE TABLE `wp_postmeta_temp` ( | |
`meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`post_id` bigint(20) unsigned NOT NULL DEFAULT '0', | |
`meta_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, | |
`meta_value` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci, | |
PRIMARY KEY (`meta_id`), | |
KEY `post_id` (`post_id`), | |
KEY `meta_key` (`meta_key`(191)) | |
) ENGINE=InnoDB AUTO_INCREMENT=3622774 DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci; | |
INSERT INTO wp_postmeta_temp SELECT * FROM wp_postmeta; | |
RENAME TABLE wp_postmeta TO wp_postmeta_old; | |
RENAME TABLE wp_postmeta_temp TO wp_postmeta; | |
# wp_options | |
CREATE TABLE `wp_options_temp` ( | |
`option_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`option_name` varchar(191) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', | |
`option_value` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, | |
`autoload` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'yes', | |
PRIMARY KEY (`option_id`), | |
UNIQUE KEY `option_name` (`option_name`), | |
KEY `autoload` (`autoload`), | |
KEY `i1` (`autoload`,`option_name`,`option_value`(50)) | |
) ENGINE=InnoDB AUTO_INCREMENT=120198 DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci; | |
INSERT INTO wp_options_temp SELECT * FROM wp_options; | |
RENAME TABLE wp_options TO wp_options_old; | |
RENAME TABLE wp_options_temp TO wp_options; | |
# wp_term_relationships | |
CREATE TABLE `wp_term_relationships_temp` ( | |
`object_id` bigint(20) unsigned NOT NULL DEFAULT '0', | |
`term_taxonomy_id` bigint(20) unsigned NOT NULL DEFAULT '0', | |
`term_order` int(11) NOT NULL DEFAULT '0', | |
PRIMARY KEY (`object_id`,`term_taxonomy_id`), | |
KEY `term_taxonomy_id` (`term_taxonomy_id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci; | |
INSERT INTO wp_term_relationships_temp SELECT * FROM wp_term_relationships; | |
RENAME TABLE wp_term_relationships TO wp_term_relationships_old; | |
RENAME TABLE wp_term_relationships_temp TO wp_term_relationships; | |
# wp_term_taxonomy | |
CREATE TABLE `wp_term_taxonomy_temp` ( | |
`term_taxonomy_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`term_id` bigint(20) unsigned NOT NULL DEFAULT '0', | |
`taxonomy` varchar(32) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', | |
`description` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, | |
`parent` bigint(20) unsigned NOT NULL DEFAULT '0', | |
`count` bigint(20) NOT NULL DEFAULT '0', | |
PRIMARY KEY (`term_taxonomy_id`), | |
UNIQUE KEY `term_id_taxonomy` (`term_id`,`taxonomy`), | |
KEY `taxonomy` (`taxonomy`) | |
) ENGINE=InnoDB AUTO_INCREMENT=2622 DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci; | |
INSERT INTO wp_term_taxonomy_temp SELECT * FROM wp_term_taxonomy; | |
RENAME TABLE wp_term_taxonomy TO wp_term_taxonomy_old; | |
RENAME TABLE wp_term_taxonomy_temp TO wp_term_taxonomy; | |
# wp_termmeta | |
CREATE TABLE `wp_termmeta_temp` ( | |
`meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`term_id` bigint(20) unsigned NOT NULL DEFAULT '0', | |
`meta_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, | |
`meta_value` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci, | |
PRIMARY KEY (`meta_id`), | |
KEY `term_id` (`term_id`), | |
KEY `meta_key` (`meta_key`(191)) | |
) ENGINE=InnoDB AUTO_INCREMENT=9486 DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci; | |
INSERT INTO wp_termmeta_temp SELECT * FROM wp_termmeta; | |
RENAME TABLE wp_termmeta TO wp_termmeta_old; | |
RENAME TABLE wp_termmeta_temp TO wp_termmeta; | |
# wp_terms | |
CREATE TABLE `wp_terms_temp` ( | |
`term_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`name` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', | |
`slug` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', | |
`term_group` bigint(10) NOT NULL DEFAULT '0', | |
PRIMARY KEY (`term_id`), | |
KEY `slug` (`slug`(191)), | |
KEY `name` (`name`(191)) | |
) ENGINE=InnoDB AUTO_INCREMENT=2622 DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci; | |
INSERT INTO wp_terms_temp SELECT * FROM wp_terms; | |
RENAME TABLE wp_terms TO wp_terms_old; | |
RENAME TABLE wp_terms_temp TO wp_terms; | |
# wp_usermeta | |
CREATE TABLE `wp_usermeta_temp` ( | |
`umeta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`user_id` bigint(20) unsigned NOT NULL DEFAULT '0', | |
`meta_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, | |
`meta_value` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci, | |
PRIMARY KEY (`umeta_id`), | |
KEY `user_id` (`user_id`), | |
KEY `meta_key` (`meta_key`(191)) | |
) ENGINE=InnoDB AUTO_INCREMENT=2382 DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci; | |
INSERT INTO wp_usermeta_temp SELECT * FROM wp_usermeta; | |
RENAME TABLE wp_usermeta TO wp_usermeta_old; | |
RENAME TABLE wp_usermeta_temp TO wp_usermeta; | |
# wp_users | |
CREATE TABLE `wp_users_temp` ( | |
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`user_login` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', | |
`user_pass` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', | |
`user_nicename` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', | |
`user_email` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', | |
`user_url` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', | |
`user_registered` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', | |
`user_activation_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', | |
`user_status` int(11) NOT NULL DEFAULT '0', | |
`display_name` varchar(250) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', | |
PRIMARY KEY (`ID`), | |
KEY `user_login_key` (`user_login`), | |
KEY `user_nicename` (`user_nicename`), | |
KEY `user_email` (`user_email`) | |
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci; | |
INSERT INTO wp_users_temp SELECT * FROM wp_users; | |
RENAME TABLE wp_users TO wp_users_old; | |
RENAME TABLE wp_users_temp TO wp_users; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment