Open sekmo opened 11 months ago
I think you have added those indices throught schema.rb or some other way.
Can you reproduce it in a empty database/project ?
mm but what's the point of trying on an empty DB? Gems are usually added to existing projects with populated DBs, no?
If the tagging tables/relations existed in the database, that mean the migrations will fail.
This is an issue on a new DB as well (I just ran across it). It is because the previous migration does this:
create_table ActsAsTaggableOn.taggings_table do |t|
t.references :tag, foreign_key: { to_table: ActsAsTaggableOn.tags_table }
Which creates a foreign key which must be removed first.
I added the line as per this PR and it fixed it.
Hey, I've noticed that if we run the migrations generated by this gem using a MySQL database we get an error that prevents the migration from being run successfully. Specifically, when the
AddMissingUniqueIndices
migration runs, we try to remove thetag_id
index from thetaggings
table, but it fails because we have the foreign key ontags(id)
.I've encountered this problem with MySQL 5.7 (the most used nowadays), 8.0.32, and 8.0.33.
This is the error:
With this fix we remove the foreign key before the offending line, and add it again at the end, after we create the compound index.