Skip to content

Instantly share code, notes, and snippets.

@ta1kt0me
Forked from keitaj/ar_innodb_row_format.rb
Last active August 29, 2015 14:27
Show Gist options
  • Save ta1kt0me/fc350f3222df027f3572 to your computer and use it in GitHub Desktop.
Save ta1kt0me/fc350f3222df027f3572 to your computer and use it in GitHub Desktop.
It is forked from https://gist.github.com/keitaj/773c6ba89ffc722d60a5 . It changes ROW_FORMAT to COMPRESSED.
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=COMPRESSED')
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