How to ensure that only unique row combinations are present?
Triggers will not work on some scenarios. Let set1(A,B), set2(A,B,C) Now one cann't move to set2(A,B,D) by dropping set2-C and adding set2-D assignments because DB must go through prohibited set1(A,B), set2(A,B) state.
You should implement custom API, stored procedures or something with proper transactions which will check only final target state. Also those procs should place locks on updated set rows during the transaction. Because really what is updated is set.