[Dbix-class] Deployment seems to destroy CHARACTER SET settings on MySQL tables

Matija Grabnar matija at serverflow.com
Sun Aug 10 14:25:07 GMT 2014

I am developing a Catalyst application that uses DBIx::Class. I thought 
I would do things right and use DBIx::Class::DeploymentHandler right 
from the start.
I was able to get it to deploy and upgrade my tables very nicely.
However, I have run into a show stopper now:

The character set settings of tables and strings are not preserved. That 
means that if I declare a table like this:

create table graph_category (
id serial primary key,
category varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
unique index i_graph_category_category(category)
) engine=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

I will get back

CREATE TABLE `graph_category` (
   `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
   `category` varchar(190) DEFAULT NULL,
   PRIMARY KEY (`id`),
   UNIQUE KEY `i_graph_category_category` (`category`)

In other words, all the character set info has disappeared. Since the 
requirements specify a lot of UTF8 work, I find that quite distressing. 
And in production, I'm afraid it could lead to data corruption.

Does anybody know of a way to avoid this problem (short of discarding 
DeploymentHandler altogether)?

More information about the DBIx-Class mailing list