Skip to content

Commit

Permalink
Change unique name contraint on Derived column so it s within invento…
Browse files Browse the repository at this point in the history
…ry type (#4472)

Fix #4343

Co-authored-by: Katherine Fleming <[email protected]>
  • Loading branch information
haneslinger and kflemin authored Jan 12, 2024
1 parent 5c10968 commit ab24aed
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions seed/migrations/0211_auto_20240109_1348.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 3.2.23 on 2024-01-09 21:48

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('seed', '0210_natural_sort'),
]

operations = [
migrations.RemoveConstraint(
model_name='derivedcolumn',
name='unique_name_for_organization',
),
migrations.AddConstraint(
model_name='derivedcolumn',
constraint=models.UniqueConstraint(fields=('organization', 'name', 'inventory_type'), name='unique_name_for_organization'),
),
]
2 changes: 1 addition & 1 deletion seed/models/derived_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class DerivedColumn(models.Model):
class Meta:
constraints = [
models.UniqueConstraint(
fields=['organization', 'name'], name='unique_name_for_organization'
fields=['organization', 'name', 'inventory_type'], name='unique_name_for_organization'
)
]

Expand Down

0 comments on commit ab24aed

Please sign in to comment.