&tag(MySQL/utf8mb4);
innodb_file_per_table = 1 # 5.6.6 innodb_file_format = Barracuda innodb_large_prefix =1 innodb_default_row_format = DYNAMIC # >= 5.7.9
ActiveSupport.on_load :active_record do
module ActiveRecord::ConnectionAdapters
class AbstractMysqlAdapter
def create_table_with_innodb_row_format(table_name, options = {})
table_options = options.merge(:options => 'ENGINE=InnoDB ROW_FORMAT=DYNAMIC')
create_table_without_innodb_row_format(table_name, table_options) do |td|
yield td if block_given?
end
end
alias_method_chain :create_table, :innodb_row_format
end
end
end
SELECT row_format from information_schema.tables where table_schema='データベース名'; ALTER TABLE テーブル名 ROW_FORMAT=DYNAMIC; ALTER TABLE テーブル名 CONVERT TO CHARACTER SET utf8mb4;