I have a what some might call a pivot table for a many to many relationship. Here are the tables.
users:
- id
- name
excursions:
- id
- name
excursion_user:
- user_id
- excursion_id
I want to add a unique constraint to only allow 1 excursion per user. So the user_id excursion_id pair can only exist once in the table. How would I go about writing this constraint?