up: uses index in the same order as rails query

main
Washington Botelho 2018-03-27 17:47:48 -03:00
parent c7ce1d256a
commit c306e39513
No known key found for this signature in database
GPG Key ID: 5DE4F42A8F073617
2 changed files with 2 additions and 2 deletions

View File

@ -12,7 +12,7 @@ class CreateRateTable < ActiveRecord::Migration[5.0]
t.timestamps null: false t.timestamps null: false
end end
add_index :rating_rates, %i[author_id author_type resource_id resource_type scopeable_id scopeable_type], add_index :rating_rates, %i[author_type author_id resource_type resource_id scopeable_type scopeable_id],
name: :index_rating_rates_on_author_and_resource_and_scopeable, name: :index_rating_rates_on_author_and_resource_and_scopeable,
unique: true unique: true
end end

View File

@ -14,7 +14,7 @@ class CreateRatingTable < ActiveRecord::Migration[5.0]
t.timestamps null: false t.timestamps null: false
end end
add_index :rating_ratings, %i[resource_id resource_type scopeable_id scopeable_type], add_index :rating_ratings, %i[resource_type resource_id scopeable_type scopeable_id],
name: :index_rating_rating_on_resource_and_scopeable, name: :index_rating_rating_on_resource_and_scopeable,
unique: true unique: true
end end