Redmine2.4をインストールしようとしてMysql2::Error: Index column size too large
Redmine2.4をCentOS6.4+MySQL5.5にインストールしようとして、ひさしぶりに以下のエラーをみた。
Mysql2::Error: Index column size too large. The maximum column size is 767 bytes.: CREATE INDEX `wiki_pages_wiki_id_title` ON `wiki_pages` (`wiki_id`, `title`)/var/www/redmine/db/migrate/028_create_wiki_pages.rb:8:in `up'
これはアレだ、と思って探して見つかったのがこのエントリー。
http://blog.kamipo.net/entry/2012/11/13/102024
これどおりにMySQLの設定を変更。
my.cnf [mysqld] innodb_file_format = Barracuda innodb_file_per_table = 1 innodb_large_prefix
で再起動する。
redmineのinitializerに以下のファイルを置く。
config/initializers/tekito_na_namae.rb 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
Gemfile ~snip~ when 'mysql2' gem "mysql2", "~> 0.3.14", :platforms => [:mri, :mingw]
これで、bundle install後、再度migrationすればとおるはず。
ちなみにこのwiki_pagesテーブル。db:rollbackしても消えないので手で消した。なんでだろ。まぁ、いいや。
Wii U プレミアムセット kuro (WUP-S-KAFC)
- 出版社/メーカー: 任天堂
- 発売日: 2012/12/08
- メディア: Video Game
- 購入: 10人 クリック: 3,455回
- この商品を含むブログ (139件) を見る