Created
November 3, 2015 17:58
-
-
Save paulmars/c7b738c60a431da1a16b to your computer and use it in GitHub Desktop.
Convert all exists mysql tables to utf8.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| databasename = "DBNAME" | |
| ActiveRecord::Base.connection.tables.each do |table| | |
| sql_string = "ALTER TABLE #{databasename}.#{table} CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;" | |
| connection = ActiveRecord::Base.connection | |
| connection.execute(sql_string) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment