opensafely-core / opensafely-core/opencodelists
Upgrade deprecated `unique_together` to `UniqueConstraint`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 60
- Forks
- 16
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 17
Description
Why are we doing this?
The unique_together property may be deprecated by Django. Eventually, we will probably have to remove it. Use of its replacement UniqueConstraint is more standard and featureful and may benefit us but isn't particularly high priority. Doing so and perhaps documenting it may avoid future model additions adding more unique_together.
How will we know when it's done?
All the instances have been replaced.
What are we doing?
Replacing each model unique_together property with a UniqueConstraint. Maybe documenting somewhere that this is the pattern to use.
Check whether any of these considerations apply in Job Server and if so raise an issue there.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Search the repository for every unique_together declaration and inspect the surrounding Django model definitions. Replace each instance with a UniqueConstraint, then verify no instances remain. Check whether the same consideration applies in Job Server and raise an issue there if needed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- databases
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100