Created
March 7, 2015 01:21
-
-
Save keitaj/773c6ba89ffc722d60a5 to your computer and use it in GitHub Desktop.
utf8mb4で動かすために必要。create_tableメソッドで'ROW_FORMAT=DYNAMIC'がデフォルトで指定されるようにしておく。http://qiita.com/kamipo/items/101aaf8159cf1470d823
This file contains 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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ActiveRecord::StatementInvalid: Mysql2::Error: Index column size too large. The maximum column size is 767 bytes.: CREATE UNIQUE INDEX
unique_schema_migrations
ONschema_migrations
(version
)エラーへの対応