Skip to content
Snippets Groups Projects
Verified Commit 83ad9d5f authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Add unique index for LessonDocumentation and PersonalNote to prevent race conditions

parent f4664b57
No related branches found
No related tags found
Loading
Pipeline #6561 passed
# Generated by Django 3.1.7 on 2021-03-21 17:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('chronos', '0004_substitution_extra_lesson_year'),
('alsijil', '0011_tardiness_positive'),
]
operations = [
migrations.AlterUniqueTogether(
name='lessondocumentation',
unique_together={('lesson_period', 'week', 'year', 'event', 'extra_lesson')},
),
migrations.AlterUniqueTogether(
name='personalnote',
unique_together={('lesson_period', 'week', 'year', 'event', 'extra_lesson')},
),
]
......@@ -250,6 +250,7 @@ class PersonalNote(RegisterObjectRelatedMixin, ExtensibleModel):
check=lesson_related_constraint_q, name="one_relation_only_personal_note"
)
]
unique_together = ["lesson_period", "week", "year", "event", "extra_lesson"]
class LessonDocumentation(RegisterObjectRelatedMixin, ExtensibleModel):
......@@ -337,6 +338,7 @@ class LessonDocumentation(RegisterObjectRelatedMixin, ExtensibleModel):
check=lesson_related_constraint_q, name="one_relation_only_lesson_documentation",
)
]
unique_together = ["lesson_period", "week", "year", "event", "extra_lesson"]
class ExtraMark(ExtensibleModel):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment