@@ -477,7 +477,6 @@ def migrate(
477477 allow_destructive_snapshots : t .Optional [t .Set [str ]] = None ,
478478 allow_additive_snapshots : t .Optional [t .Set [str ]] = None ,
479479 deployability_index : t .Optional [DeployabilityIndex ] = None ,
480- directly_or_indirectly_modified_snapshots_ids : t .Optional [t .Set [SnapshotId ]] = None ,
481480 ) -> None :
482481 """Alters a physical snapshot table to match its snapshot's schema for the given collection of snapshots.
483482
@@ -487,7 +486,6 @@ def migrate(
487486 allow_destructive_snapshots: Set of snapshots that are allowed to have destructive schema changes.
488487 allow_additive_snapshots: Set of snapshots that are allowed to have additive schema changes.
489488 deployability_index: Determines snapshots that are deployable in the context of this evaluation.
490- directly_or_indirectly_modified_snapshots_ids: Set of SnapshotIds with direct or indirect changes.
491489 """
492490 deployability_index = deployability_index or DeployabilityIndex .all_deployable ()
493491 target_data_objects = self ._get_physical_data_objects (target_snapshots , deployability_index )
@@ -512,10 +510,6 @@ def migrate(
512510 allow_additive_snapshots ,
513511 self .get_adapter (s .model_gateway ),
514512 deployability_index ,
515- only_metadata_changes = s .snapshot_id
516- not in directly_or_indirectly_modified_snapshots_ids
517- if directly_or_indirectly_modified_snapshots_ids is not None
518- else False ,
519513 ),
520514 self .ddl_concurrent_tasks ,
521515 )
@@ -1117,7 +1111,6 @@ def _migrate_snapshot(
11171111 allow_additive_snapshots : t .Set [str ],
11181112 adapter : EngineAdapter ,
11191113 deployability_index : DeployabilityIndex ,
1120- only_metadata_changes : bool ,
11211114 ) -> None :
11221115 if not snapshot .is_model or snapshot .is_symbolic :
11231116 return
@@ -1161,7 +1154,6 @@ def _migrate_snapshot(
11611154 allow_destructive_snapshots = allow_destructive_snapshots ,
11621155 allow_additive_snapshots = allow_additive_snapshots ,
11631156 run_pre_post_statements = True ,
1164- only_metadata_changes = only_metadata_changes ,
11651157 )
11661158 else :
11671159 self ._execute_create (
@@ -1198,7 +1190,6 @@ def _migrate_target_table(
11981190 allow_destructive_snapshots : t .Set [str ],
11991191 allow_additive_snapshots : t .Set [str ],
12001192 run_pre_post_statements : bool = False ,
1201- only_metadata_changes : bool = False ,
12021193 ) -> None :
12031194 adapter = self .get_adapter (snapshot .model .gateway )
12041195
@@ -1235,7 +1226,6 @@ def _migrate_target_table(
12351226 ignore_destructive = snapshot .model .on_destructive_change .is_ignore ,
12361227 ignore_additive = snapshot .model .on_additive_change .is_ignore ,
12371228 deployability_index = deployability_index ,
1238- only_metadata_changes = only_metadata_changes ,
12391229 )
12401230 finally :
12411231 if snapshot .is_materialized :
@@ -2770,8 +2760,12 @@ def migrate(
27702760 ** kwargs : t .Any ,
27712761 ) -> None :
27722762 logger .info ("Migrating view '%s'" , target_table_name )
2773- if not (
2774- kwargs ["only_metadata_changes" ] and self .adapter .COMMENT_CREATION_VIEW .is_unsupported
2763+ # Optimization: avoid unnecessary recreation when possible
2764+ if (
2765+ snapshot .model .forward_only
2766+ or bool (snapshot .model .physical_version )
2767+ or not snapshot .virtual_environment_mode .is_full
2768+ or not self .adapter .COMMENT_CREATION_VIEW .is_unsupported
27752769 ):
27762770 model = snapshot .model
27772771 render_kwargs = dict (
0 commit comments