Swiss-Polar-Institute / project-application

Application to track proposals and projects from their submission to finalisation
MIT License
7 stars 4 forks source link

Incorrect usage of unique_together in many Models #478

Closed cpina closed 1 year ago

cpina commented 2 years ago

When @jen-thomas and I wrote the models we over-used unique_together to avoid "duplicates".

In many of the cases we created "unique_together" to have a constraint and not needed an index.

We should have used https://docs.djangoproject.com/en/4.0/ref/models/constraints/#uniqueconstraint to make it more clear and avoid possible problems with too long indexes (which happened when we migrated to a certain MariaDB version).

This is just a heads up for the new maintainer @macloux , it doesn't actually cause any problem now or in short term (that I know of).