How to implement a unique index on two columns in rails

后端 未结 1 1294
庸人自扰
庸人自扰 2020-12-04 18:28

I have a table and I\'m trying to add a unique index on two columns. Those columns are also indexed. So my question is if I just can remove the indexes who were just for one

1条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-04 19:31

    add_index :subscriptions, [:user_id, :content_id], unique: true
    

    0 讨论(0)
提交回复
热议问题