Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save TimLang/ffc7c03cf277fd83526194b831289fd1 to your computer and use it in GitHub Desktop.
Save TimLang/ffc7c03cf277fd83526194b831289fd1 to your computer and use it in GitHub Desktop.

Revisions

  1. @sukeerthiadiga sukeerthiadiga revised this gist Sep 23, 2012. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,12 @@
    in console if your database is not huge.
    locate my.cnf

    change character set and collation

    [mysqld]
    character_set_server = utf8
    collation_server = utf8_general_ci

    in console if your database is not huge.

    ActiveRecord::Base.connection.tables.each do |table|
    ActiveRecord::Base.connection.execute "ALTER TABLE #{table} CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;"
  2. @sukeerthiadiga sukeerthiadiga created this gist Sep 23, 2012.
    6 changes: 6 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    in console if your database is not huge.


    ActiveRecord::Base.connection.tables.each do |table|
    ActiveRecord::Base.connection.execute "ALTER TABLE #{table} CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;"
    end