mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(db): add error_type
, error_message
, rename error
-> error_traceback
to session_queue
table
This commit is contained in:
parent
3c41c67d13
commit
887b73aece
@ -12,6 +12,7 @@ from invokeai.app.services.shared.sqlite_migrator.migrations.migration_6 import
|
|||||||
from invokeai.app.services.shared.sqlite_migrator.migrations.migration_7 import build_migration_7
|
from invokeai.app.services.shared.sqlite_migrator.migrations.migration_7 import build_migration_7
|
||||||
from invokeai.app.services.shared.sqlite_migrator.migrations.migration_8 import build_migration_8
|
from invokeai.app.services.shared.sqlite_migrator.migrations.migration_8 import build_migration_8
|
||||||
from invokeai.app.services.shared.sqlite_migrator.migrations.migration_9 import build_migration_9
|
from invokeai.app.services.shared.sqlite_migrator.migrations.migration_9 import build_migration_9
|
||||||
|
from invokeai.app.services.shared.sqlite_migrator.migrations.migration_10 import build_migration_10
|
||||||
from invokeai.app.services.shared.sqlite_migrator.sqlite_migrator_impl import SqliteMigrator
|
from invokeai.app.services.shared.sqlite_migrator.sqlite_migrator_impl import SqliteMigrator
|
||||||
|
|
||||||
|
|
||||||
@ -41,6 +42,7 @@ def init_db(config: InvokeAIAppConfig, logger: Logger, image_files: ImageFileSto
|
|||||||
migrator.register_migration(build_migration_7())
|
migrator.register_migration(build_migration_7())
|
||||||
migrator.register_migration(build_migration_8(app_config=config))
|
migrator.register_migration(build_migration_8(app_config=config))
|
||||||
migrator.register_migration(build_migration_9())
|
migrator.register_migration(build_migration_9())
|
||||||
|
migrator.register_migration(build_migration_10())
|
||||||
migrator.run_migrations()
|
migrator.run_migrations()
|
||||||
|
|
||||||
return db
|
return db
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
import sqlite3
|
||||||
|
|
||||||
|
from invokeai.app.services.shared.sqlite_migrator.sqlite_migrator_common import Migration
|
||||||
|
|
||||||
|
|
||||||
|
class Migration10Callback:
|
||||||
|
def __call__(self, cursor: sqlite3.Cursor) -> None:
|
||||||
|
self._update_error_cols(cursor)
|
||||||
|
|
||||||
|
def _update_error_cols(self, cursor: sqlite3.Cursor) -> None:
|
||||||
|
"""
|
||||||
|
- Adds `error_type` and `error_message` columns to the session queue table.
|
||||||
|
- Renames the `error` column to `error_traceback`.
|
||||||
|
"""
|
||||||
|
|
||||||
|
cursor.execute("ALTER TABLE session_queue ADD COLUMN error_type TEXT;")
|
||||||
|
cursor.execute("ALTER TABLE session_queue ADD COLUMN error_message TEXT;")
|
||||||
|
cursor.execute("ALTER TABLE session_queue RENAME COLUMN error TO error_traceback;")
|
||||||
|
|
||||||
|
|
||||||
|
def build_migration_10() -> Migration:
|
||||||
|
"""
|
||||||
|
Build the migration from database version 9 to 10.
|
||||||
|
|
||||||
|
This migration does the following:
|
||||||
|
- Adds `error_type` and `error_message` columns to the session queue table.
|
||||||
|
- Renames the `error` column to `error_traceback`.
|
||||||
|
"""
|
||||||
|
migration_10 = Migration(
|
||||||
|
from_version=9,
|
||||||
|
to_version=10,
|
||||||
|
callback=Migration10Callback(),
|
||||||
|
)
|
||||||
|
|
||||||
|
return migration_10
|
Loading…
Reference in New Issue
Block a user