Skip to content

Commit f17956a

Browse files
committed
Set graph version on branch creation
1 parent d50afb5 commit f17956a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

backend/infrahub/core/branch/models.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
from pydantic import Field, field_validator
77

88
from infrahub.core.branch.enums import BranchStatus
9-
from infrahub.core.constants import (
10-
GLOBAL_BRANCH_NAME,
11-
)
9+
from infrahub.core.constants import GLOBAL_BRANCH_NAME
10+
from infrahub.core.graph import GRAPH_VERSION
1211
from infrahub.core.models import SchemaBranchHash # noqa: TC001
1312
from infrahub.core.node.standard import StandardNode
1413
from infrahub.core.query import QueryType
@@ -262,6 +261,10 @@ def get_branches_and_times_for_range(
262261

263262
return start, end
264263

264+
async def create(self, db: InfrahubDatabase) -> bool:
265+
self.graph_version = GRAPH_VERSION
266+
return await super().create(db=db)
267+
265268
async def delete(self, db: InfrahubDatabase) -> None:
266269
if self.is_default:
267270
raise ValidationError(f"Unable to delete {self.name} it is the default branch.")

0 commit comments

Comments
 (0)