Skip to content

Instantly share code, notes, and snippets.

@keitaj
Created March 7, 2015 01:21
Show Gist options
  • Save keitaj/773c6ba89ffc722d60a5 to your computer and use it in GitHub Desktop.
Save keitaj/773c6ba89ffc722d60a5 to your computer and use it in GitHub Desktop.
utf8mb4で動かすために必要。create_tableメソッドで'ROW_FORMAT=DYNAMIC'がデフォルトで指定されるようにしておく。http://qiita.com/kamipo/items/101aaf8159cf1470d823
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
@keitaj
Copy link
Author

keitaj commented Mar 7, 2015

ActiveRecord::StatementInvalid: Mysql2::Error: Index column size too large. The maximum column size is 767 bytes.: CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations (version)

エラーへの対応

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment