Open kassi opened 3 years ago
Got the same issue here, any solution for this?
Can confirm this error in acts-as-taggable-on 7.0, ruby 2.7.1 and rails 6.1.4
Found in 9.0.1, rails 7.0.4, ruby 3.1.1p18
same here, workaround?
bin/rails db:rollback
Commented out line in the 2nd migration as so:
#remove_index ActsAsTaggableOn.taggings_table, :tag_id if index_exists?(ActsAsTaggableOn.taggings_table, :tag_id)
bin/rails db:migration
This allowed the db:migrate
to complete. Not sure on implications.
Replace up
with this and it works.
def self.up
add_index ActsAsTaggableOn.tags_table, :name, unique: true
remove_foreign_key ActsAsTaggableOn.taggings_table, :tags if foreign_key_exists?(ActsAsTaggableOn.taggings_table, :tags)
remove_index ActsAsTaggableOn.taggings_table, :tag_id if index_exists?(ActsAsTaggableOn.taggings_table, :tag_id)
remove_index ActsAsTaggableOn.taggings_table, name: 'taggings_taggable_context_idx'
add_index ActsAsTaggableOn.taggings_table,
%i[tag_id taggable_id taggable_type context tagger_id tagger_type],
unique: true, name: 'taggings_idx'
add_foreign_key ActsAsTaggableOn.taggings_table, ActsAsTaggableOn.tags_table, column: :tag_id
end
Following the installation instructions in a Ruby 3, Rails 6 application, I get the following MySQL error:
Only the first migration is up. Looks like the auto generated migrations don't play well together.