blob: 27480ad818079bc033bd069687870591805d5d25 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
class MySqlChangeCharset < ActiveRecord::Migration
def change
# this isn't needed when the database was created in utf8mb4
# if /^mysql2?$/i =~ ActiveRecord::Base.connection.adapter_name
# charset = "utf8mb4"
# collation = "utf8mb4_general_ci"
# # database
# execute "ALTER DATABASE #{connection.current_database} DEFAULT CHARACTER SET #{charset} COLLATE #{collation}"
# # schema_migrations
# execute "ALTER TABLE schema_migrations CHANGE version version VARCHAR(191) CHARACTER SET #{charset} COLLATE #{collation}"
# # table
# connection.tables.each do |table|
# execute "ALTER TABLE #{table} CONVERT TO CHARACTER SET #{charset} COLLATE #{collation}"
# end
# else
# raise ActiveRecord::IrreversibleMigration.new("Migration error: Unsupported database for migration to utf8mb4 support.")
# end
end
end
|