@@ -82,15 +82,23 @@ def _handle_migration(
8282 if migration_instance .is_migrated :
8383 # set the updated manifest version, after migration has been applied
8484 self ._set_manifest_version (migration_version )
85- # set the migration trace
8685 self ._set_migration_trace (migration_class , manifest_version , migration_version )
8786 else :
8887 LOGGER .info (
89- f"Manifest migration: `{ migration_instance . __name__ } ` is not supported for the given manifest version `{ manifest_version } `." ,
88+ f"Manifest migration: `{ self . _get_migration_name ( migration_class ) } ` is not supported for the given manifest version `{ manifest_version } `." ,
9089 )
9190 except Exception as e :
9291 raise ManifestMigrationException (str (e )) from e
9392
93+ def _get_migration_name (self , migration_class : Type [ManifestMigration ]) -> str :
94+ """
95+ Get the name of the migration instance.
96+
97+ Returns:
98+ str: The name of the migration.
99+ """
100+ return migration_class .__name__
101+
94102 def _get_manifest_version (self ) -> str :
95103 """
96104 Get the manifest version from the manifest.
@@ -101,8 +109,20 @@ def _get_manifest_version(self) -> str:
101109 return str (self ._migrated_manifest .get (MANIFEST_VERSION_TAG , "0.0.0" ))
102110
103111 def _version_is_valid_for_migration (
104- self , manifest_version : str , migration_version : str
112+ self ,
113+ manifest_version : str ,
114+ migration_version : str ,
105115 ) -> bool :
116+ """
117+ Checks if the given manifest version is less than or equal to the specified migration version.
118+
119+ Args:
120+ manifest_version (str): The version of the manifest to check.
121+ migration_version (str): The migration version to compare against.
122+
123+ Returns:
124+ bool: True if the manifest version is less than or equal to the migration version, False otherwise.
125+ """
106126 return Version (manifest_version ) <= Version (migration_version )
107127
108128 def _set_manifest_version (self , version : str ) -> None :
@@ -120,7 +140,7 @@ def _set_migration_trace(
120140 migration_version : str ,
121141 ) -> None :
122142 """
123- Set the migration trace in the manifest.
143+ Set the migration trace in the manifest, under the `metadata.applied_migrations` property object .
124144
125145 :param migration_instance: The migration instance to set
126146 :param manifest_version: The manifest version before migration
@@ -135,7 +155,7 @@ def _set_migration_trace(
135155 migration_trace = MigrationTrace (
136156 from_version = manifest_version ,
137157 to_version = migration_version ,
138- migration = migration_instance . __name__ ,
158+ migration = self . _get_migration_name ( migration_instance ) ,
139159 migrated_at = datetime .now (tz = timezone .utc ).isoformat (),
140160 ).as_dict ()
141161
0 commit comments