Skip to content

Commit 1838e91

Browse files
authored
Merge pull request #25 from buildingSMART/to-dev/feature/IVS-208_ModelInstance_unique_constraint
To DEV/IVS-208
2 parents d3cc8fa + 1312041 commit 1838e91

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated by Django 5.1.3 on 2024-11-11 22:39
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('ifc_validation_models', '0001_initial'),
10+
]
11+
12+
operations = [
13+
migrations.AddConstraint(
14+
model_name='modelinstance',
15+
constraint=models.UniqueConstraint(fields=('model_id', 'stepfile_id', 'ifc_type'), name='modelid_stepfileid_ifctype'),
16+
),
17+
]

models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,10 @@ class Meta:
604604
verbose_name = "Model Instance"
605605
verbose_name_plural = "Model Instances"
606606

607+
constraints = [
608+
models.UniqueConstraint(fields=['model_id', 'stepfile_id', 'ifc_type'], name='modelid_stepfileid_ifctype')
609+
]
610+
607611
def __str__(self):
608612

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

0 commit comments

Comments
 (0)