LoginSignup
1
0

More than 5 years have passed since last update.

[エラー] ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin; (ActiveRecord::StatementInvalid)ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin; (ActiveRecord::StatementInvalid)

Posted at

既存のRailsアプリをcloneしてきてマイグレーションしたらエラーが発生。
データベースにはMySQL5.5を使用。

Mysql2::Error: Table '****_development.tags' doesn't exist: ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin; (ActiveRecord::StatementInvalid)

acts-as-taggable-onというgemが原因のようだ。

Githubの公式によれば、MySQLユーザーは下記の設定が必要なようだ。

/config/initializes/acts_as_taggable_on.rb
ActsAsTaggableOn.force_binary_collation = true

上記の一文をコメントアウトしてマイグレーションを実行すればよい。
https://github.com/mbleigh/acts-as-taggable-on/issues/623#issuecomment-97640109

マイグレーションが完了したらコメントアウトを戻す。
次回からのマイグレーションは普通に実行される。
釈然としないがとりあえず解決。

以上。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0