diff options
author | re4k <re4k@re4k.info> | 2013-04-25 20:38:45 +0900 |
---|---|---|
committer | re4k <re4k@re4k.info> | 2013-04-25 20:38:45 +0900 |
commit | f85de521b2c5dff2f557029b84cd4ab1639241e4 (patch) | |
tree | ea503828d9234a140e5c94a189a87c92d187fecc /config | |
parent | e6cbb503f22a476bd0796f1ef4618a1692551f42 (diff) | |
download | aclog-f85de521b2c5dff2f557029b84cd4ab1639241e4.tar.gz |
fix migration error (caused by changing charset)
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/ar_innodb_row_format.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/config/initializers/ar_innodb_row_format.rb b/config/initializers/ar_innodb_row_format.rb new file mode 100644 index 0000000..f6b88e1 --- /dev/null +++ b/config/initializers/ar_innodb_row_format.rb @@ -0,0 +1,16 @@ +# http://qiita.com/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.reverse_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 |