diff --git a/db/migrate/20200320082708_uniq_index_on_collections.rb b/db/migrate/20200320152708_uniq_index_on_collections.rb similarity index 50% rename from db/migrate/20200320082708_uniq_index_on_collections.rb rename to db/migrate/20200320152708_uniq_index_on_collections.rb index 30b55def4..65eecb309 100644 --- a/db/migrate/20200320082708_uniq_index_on_collections.rb +++ b/db/migrate/20200320152708_uniq_index_on_collections.rb @@ -1,6 +1,7 @@ class UniqIndexOnCollections < ActiveRecord::Migration[5.2] def change remove_index :collections, [:container_type, :container_id] - add_index :collections, [:container_type, :container_id], unique: true + add_index :collections, [:container_type, :container_id] + add_index :collections, [:user_id, :container_type, :container_id], unique: true end end