Skip to content

Commit

Permalink
fix(api): made Score unique per passport (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucianHymer authored Apr 24, 2023
1 parent d852413 commit ae8d153
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions api/registry/migrations/0009_alter_score_passport.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.1.7 on 2023-04-24 21:18

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("registry", "0008_remove_passport_passport"),
]

operations = [
migrations.AlterField(
model_name="score",
name="passport",
field=models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="score",
to="registry.passport",
unique=True,
),
),
]
2 changes: 1 addition & 1 deletion api/registry/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Status:
]

passport = models.ForeignKey(
Passport, on_delete=models.PROTECT, related_name="score"
Passport, on_delete=models.PROTECT, related_name="score", unique=True
)
score = models.DecimalField(null=True, blank=True, decimal_places=9, max_digits=18)
last_score_timestamp = models.DateTimeField(default=None, null=True, blank=True)
Expand Down

0 comments on commit ae8d153

Please sign in to comment.