feat(db): instantiate SqliteMigrator with a SqliteDatabase

Simplifies a couple things:
- Init is more straightforward
- It's clear in the migrator that the connection we are working with is related to the SqliteDatabase
This commit is contained in:
psychedelicious
2023-12-12 10:46:08 +11:00
parent 417db71471
commit 3414437eea
7 changed files with 58 additions and 101 deletions

View File

@ -77,13 +77,7 @@ class ApiDependencies:
db_path = None if config.use_memory_db else config.db_path
db = SqliteDatabase(db_path=db_path, logger=logger, verbose=config.log_sql)
migrator = SQLiteMigrator(
db_path=db.db_path,
conn=db.conn,
lock=db.lock,
logger=logger,
log_sql=config.log_sql,
)
migrator = SQLiteMigrator(db=db)
migration_2.register_post_callback(partial(migrate_embedded_workflows, logger=logger, image_files=image_files))
migrator.register_migration(migration_1)
migrator.register_migration(migration_2)