Tag: Rails/絵文字を扱う
default: &default adapter: mysql2 encoding: utf8mb4 pool: 5
mysqldump --single-transaction --no-create-info --replace --default-character-set=binary --quick sample_production > data.sql
module InnodbRowFormat def create_table(table_name, options = {}) table_options = options.merge(options: 'ENGINE=InnoDB ROW_FORMAT=DYNAMIC') super(table_name, table_options) do |td| yield td if block_given? end end end ActiveSupport.on_load :active_record do module ActiveRecord::ConnectionAdapters class AbstractMysqlAdapter prepend InnodbRowFormat end end end
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
bundle exec rake db:reset RAILS_ENV=production
mysql asl_production < data.sql