Skip to content

Commit 0819132

Browse files
committed
Need to load schema before rebase
1 parent eb22a53 commit 0819132

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

backend/infrahub/core/migrations/shared.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
)
2222
from infrahub.core.timestamp import Timestamp
2323
from infrahub.exceptions import ValidationError
24+
from infrahub.lock import initialize_lock
2425

2526
from .query import MigrationBaseQuery # noqa: TC001
2627

@@ -283,6 +284,8 @@ async def execute_against_branches(self, db: InfrahubDatabase, branches: Sequenc
283284
result = MigrationResult()
284285

285286
for branch in branches:
287+
await registry.schema.load_schema(db=db, branch=branch)
288+
286289
if not await self.rebase_branch(db=db, branch=branch):
287290
result.errors.append(f"Failed to rebase branch '{branch.name}' ({branch.uuid})")
288291
continue
@@ -295,4 +298,9 @@ async def execute_against_branches(self, db: InfrahubDatabase, branches: Sequenc
295298
return result
296299

297300
async def execute(self, db: InfrahubDatabase) -> MigrationResult:
301+
from infrahub.core.initialization import initialization
302+
303+
initialize_lock()
304+
await initialization(db=db)
305+
298306
return await self.execute_against_branch(db=db, branch=registry.get_branch_from_registry())

0 commit comments

Comments
 (0)