-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mysql2::Error: Cannot drop index 'index_taggings_on_tag_id': needed in a foreign key constraint: DROP INDEX index_taggings_on_tag_id
ON taggings
#978
Comments
Yes, it's a problem
in |
Error explained in issue 978 (mbleigh#978)
I created a PR for this, you have top remove the foreign key prior to removing the index. |
'AddMissingUniqueIndices'でindexを削除する際に外部キーを削除せずにインデックスを削除しようとしていたことが原因のようだ。 インデックス削除前に外部キーを削除すれば想定通りの動作になる。 参考: (mbleigh/acts-as-taggable-on#978) (https://teratail.com/questions/224720)
Can you guys shed a little bit more light on this issue? What causes it exactly? Is this a problem for a particular version of rails or for all of them? What does the solution mean? |
+1 |
2 similar comments
+1 |
+1 |
Can be fixed with 4945323 add_foreign_key ActsAsTaggableOn.taggings_table, ActsAsTaggableOn.tags_table, column: 'tag_id' |
Closing this issue! |
Still happening to me in:
|
Can confirm, following the install instructions in the Readme on a 6.1 project with MySQL
|
using solution from mbleigh/acts-as-taggable-on#978
Same happened for me on Rails 7.1, acts-as-taggable-on 10.0.0, MariaDB 11.4.2. The migrations work fine on PostgreSQL and SQLite, so this is a MariaDB/MySQL specific thing. Fixed with @ndrix and @mrIllo's method of removing and re-enabling. Seems like the generator should perhaps combine those two migrations into one so that the second doesn't immediately have to alter the first? I guess |
I got an error while running
rails db:migrate
. I'm using rails 5.2 and ruby 2.5.3Here's the log
The text was updated successfully, but these errors were encountered: