Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integrity constraints to database models #355

Open
TimJentzsch opened this issue Feb 7, 2022 · 0 comments
Open

Add integrity constraints to database models #355

TimJentzsch opened this issue Feb 7, 2022 · 0 comments
Labels
API Suggestion which would change the user-facing API enhancement New feature or request

Comments

@TimJentzsch
Copy link
Contributor

TimJentzsch commented Feb 7, 2022

We have a couple of constraints that should always hold.
I'm not sure if it's possible to encode these in Django, but if it is, it would help to keep our data clean and potentially speed up some queries.

Note that we might need to fix some faulty data if we integrate this.

Some constraints that I can think of at the top of my head:

Submission:

  • If claimed_by is not null, then claim_time is not null
  • If completed_by is not null, then complete_time is not null
  • If completed_by is not null, then claimed_by is not null
  • create_time <= claim_time <= complete_time
  • If removed_from_queue is true, then approved is false
  • If approved is true then removed_from_queue is false
@TimJentzsch TimJentzsch added enhancement New feature or request API Suggestion which would change the user-facing API labels Feb 7, 2022
@TimJentzsch TimJentzsch changed the title Add integrety constraints to database models Add integrity constraints to database models Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Suggestion which would change the user-facing API enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant