Suppose I have two tables: thread and user, with a join table thread_user that models a many-to-many relationship between them.
Suppose I want to enforce the following constraints:
- A
threadcan have at most 10users. - No two
threads should have the same set ofusers.
How can this be done? The first constraint seems easy enough to enforce with a trigger (is there a better approach?). The second constraint I have no idea how to enforce.