-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
ActiveRecord migrations with polymorphic references create indexes with different name #41693
Comments
* Use ActiveRecord::Result#to_ary instead of deprecated to_hash They do the same thing, and to_hash has been removed from Rails 6.1 * Explicitly name polymorphic indexes to workaround a bug in Rails 6.1 cf. rails/rails#41693 * Fix incorrect usage of “foreign_key” in migration script * Use `ActiveModel::Errors#delete` instead of deprecated clear method * Fix link headers tests on Rails 6.1 Rails 6.1 adds values to the Link header by default, thus it is not a LinkHeader object anymore. Fix the test to parse the Link header instead of assuming it is a LinkHeader.
Same issue #41547 |
@ClearlyClaire @aglushkov Could you give #42350 a try and let us know if that solves your issue? |
This issue has been automatically marked as stale because it has not been commented on for at least three months. |
* Use ActiveRecord::Result#to_ary instead of deprecated to_hash They do the same thing, and to_hash has been removed from Rails 6.1 * Explicitly name polymorphic indexes to workaround a bug in Rails 6.1 cf. rails/rails#41693 * Fix incorrect usage of “foreign_key” in migration script * Use `ActiveModel::Errors#delete` instead of deprecated clear method * Fix link headers tests on Rails 6.1 Rails 6.1 adds values to the Link header by default, thus it is not a LinkHeader object anymore. Fix the test to parse the Link header instead of assuming it is a LinkHeader.
Steps to reproduce
Create a table with a polymorphic
references
in a < 6.0 migration, run the migration with ActiveRecord 6.This was most probably introduced by e8437a6.
Minimal testcase
Expected behavior
The created index should have the same name when the migration runs in ActiveRecord 6 than it had in ActiveRecord 5, in this case,
index_settings_on_target_type_and_target_id
.Actual behavior
The migration creates an index with a different name:
index_settings_on_target
.System configuration
Rails version: 6.1.3
Ruby version: 2.7.2p137
The text was updated successfully, but these errors were encountered: