Skip to content

Commit

Permalink
Add constraint that nodegroups match grouping node #11613
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Nov 14, 2024
1 parent 0304a86 commit 2ce4baf
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 5.1.3 on 2024-11-13 19:11

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("models", "11613_add_node_constraints"),
]

operations = [
migrations.AddConstraint(
model_name="node",
constraint=models.CheckConstraint(
condition=models.Q(("nodegroup_root_id", models.F("nodegroup_id"))),
name="nodegroup_root_matches_nodegroup",
),
),
]
4 changes: 4 additions & 0 deletions arches/app/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,10 @@ class Meta:
condition=Q(istopnode=True) | Q(nodegroup_root__isnull=False),
name="has_nodegroup_root_or_istopnode",
),
models.CheckConstraint(
condition=Q(nodegroup_root_id=models.F("nodegroup_id")),
name="nodegroup_root_matches_nodegroup",
),
]


Expand Down

0 comments on commit 2ce4baf

Please sign in to comment.