Skip to content

Commit

Permalink
Travis CI で utf8mb4 を使えるようにする
Browse files Browse the repository at this point in the history
  • Loading branch information
ochaochaocha3 committed Nov 30, 2016
1 parent 3f69b35 commit a83db9d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ services:
- mysql
before_script:
- cp config/database.yml.travis config/database.yml
- mysql -u root -e 'SET GLOBAL innodb_file_format = Barracuda'
- mysql -u root -e 'SET GLOBAL innodb_file_per_table = 1'
- mysql -u root -e 'SET GLOBAL innodb_large_prefix = 1'
- mysql -e 'CREATE DATABASE IF NOT EXISTS log_archiver_test;'
notifications:
irc:
Expand Down
16 changes: 16 additions & 0 deletions config/initializers/ar_innodb_row_format.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# create_table メソッドで 'ROW_FORMAT=DYNAMIC' が
# デフォルトで指定されるようにする
# @see 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

0 comments on commit a83db9d

Please sign in to comment.