I'm planning to convert a table from utf8
(_general_ci
) to utf8mb4
(utf8mb4_unicode_ci
). I want to make sure I don't have any malformed data after the conversion though so I was planning to duplicate the data, run a join on the two tables, and see if there are any differences.
Is this a good way to go about it?
1.
Create table Email_utf8mb4 like Email;
2.
insert into Email_utf8mb4 select * from Email;
3.
ALTER TABLE Email_utf8mb4
CONVERT TO CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci;
4.
select * from Email as old
join Email_utf8mb4 as new
on old.notificationid =new.notificationid
and (old.subject <> new.subject OR old.content <>
new.content)
4.5. Assuming no rows are returned...
5.
drop Email;
6.
RENAME TABLE Email_utf8mb4 to Email;
subject
and content
are the only alpha columns in my table.