mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(db): make idempotency test actually test something
This commit is contained in:
parent
3ba3c1918c
commit
3c692018cd
@ -163,9 +163,16 @@ def test_db_version_gt_last_migration(migrator: SQLiteMigrator, good_migration:
|
||||
assert migrator._get_current_version() == 2
|
||||
|
||||
|
||||
def test_idempotent_migrations(migrator: SQLiteMigrator, good_migration: Migration):
|
||||
def test_idempotent_migrations(migrator: SQLiteMigrator):
|
||||
migrator._create_version_table()
|
||||
migrator.register_migration(good_migration)
|
||||
|
||||
def create_test_table(cursor: sqlite3.Cursor) -> None:
|
||||
# This SQL throws if run twice
|
||||
cursor.execute("CREATE TABLE test (id INTEGER PRIMARY KEY);")
|
||||
|
||||
migration = Migration(db_version=1, app_version="1.0.0", migrate=create_test_table)
|
||||
|
||||
migrator.register_migration(migration)
|
||||
migrator.run_migrations()
|
||||
# not throwing is sufficient
|
||||
migrator.run_migrations()
|
||||
assert migrator._get_current_version() == 1
|
||||
|
Loading…
Reference in New Issue
Block a user