mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
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:
@ -44,13 +44,7 @@ def store(app_config: InvokeAIAppConfig) -> ModelRecordServiceBase:
|
||||
logger = InvokeAILogger.get_logger(config=app_config)
|
||||
db_path = None if app_config.use_memory_db else app_config.db_path
|
||||
db = SqliteDatabase(db_path=db_path, logger=logger, verbose=app_config.log_sql)
|
||||
migrator = SQLiteMigrator(
|
||||
db_path=db.db_path,
|
||||
conn=db.conn,
|
||||
lock=db.lock,
|
||||
logger=logger,
|
||||
log_sql=app_config.log_sql,
|
||||
)
|
||||
migrator = SQLiteMigrator(db=db)
|
||||
migrator.register_migration(migration_1)
|
||||
migrator.register_migration(migration_2)
|
||||
migrator.run_migrations()
|
||||
|
@ -35,13 +35,7 @@ def store(datadir: Any) -> ModelRecordServiceBase:
|
||||
logger = InvokeAILogger.get_logger(config=config)
|
||||
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)
|
||||
migrator.register_migration(migration_1)
|
||||
migrator.register_migration(migration_2)
|
||||
migrator.run_migrations()
|
||||
|
Reference in New Issue
Block a user