Sam Kong
Sam Kong

Reputation: 5840

Rails migration collation for MySQL

I just noticed that my recent migration created tables with collation of latin1_swedish_ci instead of utf8_unicode_ci. It used to create utf8_unicode_ci. My database.yml has encoding: utf8 and I assume all tables I create will have utf8.

My dev machine works fine but my production on a shared hosting has this problem.

Why did this happen?

Thanks.

Sam

Upvotes: 2

Views: 1563

Answers (1)

sailor
sailor

Reputation: 8044

You can force migrations with these options TYPE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci to choose the encoding, or change the default charset of your mysql server.

Upvotes: 1

Related Questions