mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(db): tidy migration_2
This commit is contained in:
parent
50815d36c6
commit
55b0c7cdc9
@ -6,12 +6,16 @@ from tqdm import tqdm
|
|||||||
from invokeai.app.services.image_files.image_files_base import ImageFileStorageBase
|
from invokeai.app.services.image_files.image_files_base import ImageFileStorageBase
|
||||||
from invokeai.app.services.shared.sqlite_migrator.sqlite_migrator_common import Migration, MigrationDependency
|
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:
|
def migrate_callback(cursor: sqlite3.Cursor, **kwargs) -> None:
|
||||||
"""Migration callback for database version 2."""
|
"""Migration callback for database version 2."""
|
||||||
|
|
||||||
logger = kwargs["logger"]
|
logger = kwargs[logger_dependency.name]
|
||||||
image_files = kwargs["image_files"]
|
image_files = kwargs[image_files_dependency.name]
|
||||||
|
|
||||||
_add_images_has_workflow(cursor)
|
_add_images_has_workflow(cursor)
|
||||||
_add_session_queue_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)
|
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(
|
migration_2 = Migration(
|
||||||
from_version=1,
|
from_version=1,
|
||||||
to_version=2,
|
to_version=2,
|
||||||
|
Loading…
Reference in New Issue
Block a user