The UNIQUE index on project_authorizations should only include (user_id, project_id)
Currently there are duplicates in this table because access_level is part of the unique index. This means that you can have multiple rows for the same (user_id, project_id) pair with. So I propose:
- We remove
access_levelfrom this UNIQUE index - We double check the populating code, as it should prevent this from happening even with the index in the current setup