diff --git a/invokeai/app/services/shared/sqlite_migrator/migrations/migration_2.py b/invokeai/app/services/shared/sqlite_migrator/migrations/migration_2.py index 7a5eb52c80..87cc3ddcea 100644 --- a/invokeai/app/services/shared/sqlite_migrator/migrations/migration_2.py +++ b/invokeai/app/services/shared/sqlite_migrator/migrations/migration_2.py @@ -6,12 +6,16 @@ from tqdm import tqdm from invokeai.app.services.image_files.image_files_base import ImageFileStorageBase from invokeai.app.services.shared.sqlite_migrator.sqlite_migrator_common import Migration, MigrationDependency +# This migration requires an ImageFileStorageBase service and logger +image_files_dependency = MigrationDependency(name="image_files", dependency_type=ImageFileStorageBase) +logger_dependency = MigrationDependency(name="logger", dependency_type=Logger) + def migrate_callback(cursor: sqlite3.Cursor, **kwargs) -> None: """Migration callback for database version 2.""" - logger = kwargs["logger"] - image_files = kwargs["image_files"] + logger = kwargs[logger_dependency.name] + image_files = kwargs[image_files_dependency.name] _add_images_has_workflow(cursor) _add_session_queue_workflow(cursor) @@ -132,10 +136,6 @@ def _migrate_embedded_workflows( cursor.executemany("UPDATE images SET has_workflow = ? WHERE image_name = ?", to_migrate) -image_files_dependency = MigrationDependency(name="image_files", dependency_type=ImageFileStorageBase) -logger_dependency = MigrationDependency(name="logger", dependency_type=Logger) - - migration_2 = Migration( from_version=1, to_version=2,