最佳答案
How can I add unique: true
constraint to already existing index in Rails database?
I tried to migrate by
def change
add_index :editabilities, [:user_id, :list_id], unique: true
end
but migration fails with a error like this.
Index name 'index_editabilities_on_user_id_and_list_id' on table 'editabilities' already exists
I'm using rails4 and postgresql.