3030 MIN_SCHEMA_VERSION ,
3131 MIN_SQLMESH_VERSION ,
3232)
33- from sqlmesh .core .state_sync .base import StateSync
3433from sqlmesh .core .state_sync .db .environment import EnvironmentState
3534from sqlmesh .core .state_sync .db .interval import IntervalState
3635from sqlmesh .core .state_sync .db .snapshot import SnapshotState
@@ -85,7 +84,7 @@ def __init__(
8584
8685 def migrate (
8786 self ,
88- state_sync : StateSync ,
87+ schema : t . Optional [ str ] ,
8988 skip_backup : bool = False ,
9089 promoted_snapshots_only : bool = True ,
9190 ) -> None :
@@ -94,7 +93,7 @@ def migrate(
9493 migration_start_ts = time .perf_counter ()
9594
9695 try :
97- migrate_rows = self ._apply_migrations (state_sync , skip_backup )
96+ migrate_rows = self ._apply_migrations (schema , skip_backup )
9897
9998 if not migrate_rows and major_minor (SQLMESH_VERSION ) == versions .minor_sqlmesh_version :
10099 return
@@ -153,7 +152,7 @@ def rollback(self) -> None:
153152
154153 def _apply_migrations (
155154 self ,
156- state_sync : StateSync ,
155+ schema : t . Optional [ str ] ,
157156 skip_backup : bool ,
158157 ) -> bool :
159158 versions = self .version_state .get_versions ()
@@ -184,10 +183,10 @@ def _apply_migrations(
184183
185184 for migration in migrations :
186185 logger .info (f"Applying migration { migration } " )
187- migration .migrate_schemas (state_sync )
186+ migration .migrate_schemas (engine_adapter = self . engine_adapter , schema = schema )
188187 if state_table_exist :
189188 # No need to run DML for the initial migration since all tables are empty
190- migration .migrate_rows (state_sync )
189+ migration .migrate_rows (engine_adapter = self . engine_adapter , schema = schema )
191190
192191 snapshot_count_after = self .snapshot_state .count ()
193192
0 commit comments