Skip to content

Commit

Permalink
Merge pull request #25 from buildingSMART/to-dev/feature/IVS-208_Mode…
Browse files Browse the repository at this point in the history
…lInstance_unique_constraint

To DEV/IVS-208
Ghesselink authored Nov 13, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents d3cc8fa + 1312041 commit 1838e91
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions migrations/0002_modelinstance_modelid_stepfileid_ifctype.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 5.1.3 on 2024-11-11 22:39

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('ifc_validation_models', '0001_initial'),
]

operations = [
migrations.AddConstraint(
model_name='modelinstance',
constraint=models.UniqueConstraint(fields=('model_id', 'stepfile_id', 'ifc_type'), name='modelid_stepfileid_ifctype'),
),
]
4 changes: 4 additions & 0 deletions models.py
Original file line number Diff line number Diff line change
@@ -604,6 +604,10 @@ class Meta:
verbose_name = "Model Instance"
verbose_name_plural = "Model Instances"

constraints = [
models.UniqueConstraint(fields=['model_id', 'stepfile_id', 'ifc_type'], name='modelid_stepfileid_ifctype')
]

def __str__(self):

return f'#{self.id} - {self.ifc_type} - {self.model.file_name}'

0 comments on commit 1838e91

Please sign in to comment.