mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-10-03 17:15:19 -07:00
fix(db): log which indexes the migration actually created
This commit is contained in:
committed by
capy-ai-staging[bot]
parent
22a3f6b3dd
commit
dd1ada8239
@@ -321,8 +321,13 @@ def _migrate_add_indexes(engine, tables: set[str]) -> None:
|
|||||||
]
|
]
|
||||||
|
|
||||||
with engine.connect() as conn:
|
with engine.connect() as conn:
|
||||||
|
existing = {
|
||||||
|
row[0]
|
||||||
|
for row in conn.execute(text("SELECT name FROM sqlite_master WHERE type = 'index'"))
|
||||||
|
}
|
||||||
|
created = []
|
||||||
for index_name, table, column in indexes:
|
for index_name, table, column in indexes:
|
||||||
if table not in tables:
|
if table not in tables or index_name in existing:
|
||||||
continue
|
continue
|
||||||
conn.execute(
|
conn.execute(
|
||||||
text(
|
text(
|
||||||
@@ -330,8 +335,12 @@ def _migrate_add_indexes(engine, tables: set[str]) -> None:
|
|||||||
f" ON {table} ({column})"
|
f" ON {table} ({column})"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
created.append(index_name)
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
||||||
|
if created:
|
||||||
|
logger.info("Created %d missing index(es): %s", len(created), ", ".join(created))
|
||||||
|
|
||||||
|
|
||||||
def _normalize_storage_paths(engine, tables: set[str]) -> None:
|
def _normalize_storage_paths(engine, tables: set[str]) -> None:
|
||||||
"""Normalize stored file paths to be relative to the configured data dir."""
|
"""Normalize stored file paths to be relative to the configured data dir."""
|
||||||
|
|||||||
Reference in New Issue
Block a user