Skip to content

Commit 8c87fc3

Browse files
committed
Add graph number in branch and set it
1 parent a692887 commit 8c87fc3

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

backend/infrahub/core/branch/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class Branch(StandardNode):
4646
is_isolated: bool = True
4747
schema_changed_at: Optional[str] = None
4848
schema_hash: Optional[SchemaBranchHash] = None
49+
graph_version: int | None = None
4950

5051
_exclude_attrs: list[str] = ["id", "uuid", "owner"]
5152

backend/infrahub/core/migrations/shared.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from typing_extensions import Self
88

99
from infrahub.core import registry
10+
from infrahub.core.branch.enums import BranchStatus
1011
from infrahub.core.path import SchemaPath # noqa: TC001
1112
from infrahub.core.query import Query # noqa: TC001
1213
from infrahub.core.schema import (
@@ -257,7 +258,7 @@ async def rebase_branch(self, db: InfrahubDatabase, branch: Branch) -> bool:
257258
try:
258259
await branch.rebase(db=db)
259260
console.print("done")
260-
except Exception:
261+
branch.graph_version = self.minimum_version + 1
261262
# NOTE: Narrow to more accurate exception
262263
console.print("failed")
263264
branch.status = BranchStatus.NEED_UPGRADE_REBASE

0 commit comments

Comments
 (0)