Skip to content

Commit efbb148

Browse files
committed
set unique constraint on parameter
1 parent 5537134 commit efbb148

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-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 3.2.25 on 2025-05-20 09:17
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('vocabularies', '0012_auto_20250514_0542'),
10+
]
11+
12+
operations = [
13+
migrations.AddConstraint(
14+
model_name='parameter',
15+
constraint=models.UniqueConstraint(fields=('version', 'kind', 'data'), name='unique_parameter'),
16+
),
17+
]

geospaas/vocabularies/models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,8 @@ def __str__(self):
5454

5555
def natural_key(self):
5656
return (self.data['standard_name'])
57+
58+
class Meta:
59+
constraints = [
60+
models.UniqueConstraint(name='unique_parameter', fields=('version', 'kind', 'data'))
61+
]

0 commit comments

Comments
 (0)