Skip to content

Commit

Permalink
feat: SAP unique on (active, assignment_configuration)
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveagent57 committed Sep 12, 2023
1 parent 24321b8 commit baabdd1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 3.2.20 on 2023-09-11 19:25

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('content_assignments', '0003_drop_assignment_policy'),
('subsidy_access_policy', '0016_assignment_config_fk'),
]

operations = [
migrations.AlterModelOptions(
name='subsidyaccesspolicy',
options={},
),
migrations.AlterUniqueTogether(
name='subsidyaccesspolicy',
unique_together={('active', 'assignment_configuration')},
),
]
6 changes: 5 additions & 1 deletion enterprise_access/apps/subsidy_access_policy/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ class SubsidyAccessPolicy(TimeStampedModel):
.. no_pii: This model has no PII
"""

class Meta:
unique_together = [
('active', 'assignment_configuration'),
]

POLICY_FIELD_NAME = 'policy_type'
policy_type = models.CharField(
max_length=64,
Expand Down Expand Up @@ -159,7 +164,6 @@ class SubsidyAccessPolicy(TimeStampedModel):
related_name='subsidy_access_policy',
on_delete=models.SET_NULL,
db_index=True,
unique=True,
null=True,
)

Expand Down

0 comments on commit baabdd1

Please sign in to comment.