Open jgrant29 opened 2 years ago
I've been helping Justin try to figure this out over at:
https://stackoverflow.com/q/70599054/479863
The migration has this:
t.references :tag, foreign_key: { to_table: ActsAsTaggableOn.tags_table }
...
add_index ActsAsTaggableOn.taggings_table, :tag_id
But the t.references
call creates the index that the add_index
is trying to add. But t.references
has been adding indexes by default for quite awhile so I'm not sure why the generated migration is broken.
Am I missing something here?
I will delete all the migrations and have only 1 that is skipped by default. It became more difficult to support those legacy migrations at every new release.
Hi all,
I am running Rails 7.0.0 and Ruby 3.0.3 with gem 'acts-as-taggable-on', '~> 9.0'. With this setup and a new rails app installation, I am receiving the errors noted below on rails db:migrate.
name@iMac alttextproject % rails db:migrate == 20220105163513 ActsAsTaggableOnMigration: migrating ======================== -- create_table(:tags) -> 0.0130s -- create_table(:taggings) -> 0.0085s -- add_index(:taggings, :tag_id) rails aborted! StandardError: An error has occurred, this and all later migrations canceled:
PG::DuplicateTable: ERROR: relation "index_taggings_on_tag_id" already exists /Users/name/here/alttextproject/db/migrate/20220105163513_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb:26:in `up'
Caused by: ActiveRecord::StatementInvalid: PG::DuplicateTable: ERROR: relation "index_taggings_on_tag_id" already exists /Users/name/here/alttextproject/db/migrate/20220105163513_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb:26:in `up'
Caused by: PG::DuplicateTable: ERROR: relation "index_taggings_on_tag_id" already exists /Users/name/here/alttextproject/db/migrate/20220105163513_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb:26:in `up'
Thanks! Justin