diff --git a/lib/generators/rating/templates/db/migrate/create_rate_table.rb b/lib/generators/rating/templates/db/migrate/create_rate_table.rb index d98a5da..ae8336f 100644 --- a/lib/generators/rating/templates/db/migrate/create_rate_table.rb +++ b/lib/generators/rating/templates/db/migrate/create_rate_table.rb @@ -12,7 +12,7 @@ class CreateRateTable < ActiveRecord::Migration[5.0] t.timestamps null: false 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, unique: true end diff --git a/lib/generators/rating/templates/db/migrate/create_rating_table.rb b/lib/generators/rating/templates/db/migrate/create_rating_table.rb index a1d34b3..d927dd4 100644 --- a/lib/generators/rating/templates/db/migrate/create_rating_table.rb +++ b/lib/generators/rating/templates/db/migrate/create_rating_table.rb @@ -14,7 +14,7 @@ class CreateRatingTable < ActiveRecord::Migration[5.0] t.timestamps null: false 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, unique: true end