feat(db): tidy migration_2

This commit is contained in:
psychedelicious 2023-12-12 13:30:29 +11:00
parent 50815d36c6
commit 55b0c7cdc9

View File

@ -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,