Closed rkoster closed 11 years ago
Should not collation_connection be set on a client side? Supposedly you created a database or a table with different collocation you can change it if you need it. Otherwise we are forcing clients to always connect with utf8_unicode_ci.
@monkeyherder & @mariash
It could be set at the client side, I was however unable to do it in the database.yml file of our rails application because this file gets overwritten during staging.
It looks like changing it in database.yml won't help anyway. You may want to try to set it like this:
ActiveRecord::Base.connection.execute "SET collation_database = 'utf8_general_ci' "
ActiveRecord::Base.connection.execute "SET collation_connection = 'utf8_general_ci' "
This change will break things for users who choose to have a non-UTF-8 collation as it forces all clients to use utf8_general_ci
collation.
As noted modifying database.yml
will not work but @monkeyherder's suggestion should be a viable workaround for ActiveRecord.
Based on this we are closing this pull request.
When I provisioned a mysql database on the mysql_node to use with my rails application I run into the following error:
ActiveRecord::StatementInvalid (Mysql2::Error: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '=':
I found out that thecollation_connection
was set toutf8_general_ci
. I was not able to change this connection at the rails side because I'm using the cf-autoconfig gem. And as a result the database.yml file is ignored.