Skip to content

Commit 6134c31

Browse files
committed
Need to load schema before rebase
1 parent e931a67 commit 6134c31

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

@@ -285,6 +286,8 @@ async def execute_against_branches(self, db: InfrahubDatabase, branches: Sequenc
285286
result = MigrationResult()
286287

287288
for branch in branches:
289+
await registry.schema.load_schema(db=db, branch=branch)
290+
288291
if not await self.rebase_branch(db=db, branch=branch):
289292
result.errors.append(f"Failed to rebase branch '{branch.name}' ({branch.uuid})")
290293
continue
@@ -297,4 +300,9 @@ async def execute_against_branches(self, db: InfrahubDatabase, branches: Sequenc
297300
return result
298301

299302
async def execute(self, db: InfrahubDatabase) -> MigrationResult:
303+
from infrahub.core.initialization import initialization
304+
305+
initialize_lock()
306+
await initialization(db=db)
307+
300308
return await self.execute_against_branch(db=db, branch=registry.get_branch_from_registry())

0 commit comments

Comments
 (0)