membershipworks: Constrain EventMeetingTime.end after start
All checks were successful
Ruff / ruff (push) Successful in 24s

This commit is contained in:
Adam Goldsmith 2024-02-12 16:26:19 -05:00
parent 8e0848ecab
commit dd6ef35223
2 changed files with 20 additions and 1 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 5.0.2 on 2024-02-12 21:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("membershipworks", "0014_remove_eventext_details_timestamp"),
]
operations = [
migrations.AddConstraint(
model_name="eventmeetingtime",
constraint=models.CheckConstraint(
check=models.Q(("end__gt", models.F("start"))), name="end_after_start"
),
),
]

View File

@ -565,7 +565,8 @@ class EventMeetingTime(models.Model):
constraints = [
models.UniqueConstraint(
fields=["event", "start", "end"], name="unique_event_start_end"
)
),
models.CheckConstraint(check=Q(end__gt=F("start")), name="end_after_start"),
]