Skip to content

Commit

Permalink
Add non-empty constraint for package name
Browse files Browse the repository at this point in the history
  • Loading branch information
jjnesbitt committed Dec 8, 2023
1 parent d2f4caa commit 89399c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.4 on 2023-11-09 20:27
# Generated by Django 4.2.4 on 2023-12-08 19:28

import django.contrib.postgres.fields
from django.db import migrations, models
Expand Down Expand Up @@ -87,6 +87,13 @@ class Migration(migrations.Migration):
fields=("project_id", "job_id"), name="unique-project-job-id"
),
),
migrations.AddConstraint(
model_name="job",
constraint=models.CheckConstraint(
check=models.Q(("package_name", ""), _negated=True),
name="non-empty-package-name",
),
),
migrations.AddConstraint(
model_name="job",
constraint=models.CheckConstraint(
Expand Down
3 changes: 3 additions & 0 deletions analytics/analytics/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ class Meta:
models.UniqueConstraint(
name="unique-project-job-id", fields=["project_id", "job_id"]
),
models.CheckConstraint(
name="non-empty-package-name", check=~models.Q(package_name="")
),
models.CheckConstraint(
name="consistent-temporary-null-values",
check=(
Expand Down

0 comments on commit 89399c4

Please sign in to comment.