mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-10-23 17:05:28 +08:00
Merge pull request #2730 from langbot-app/task/LANG-135-safe-history-indexes
LANG-135: Guard 0039 indexes against missing historical columns
This commit is contained in:
@@ -33,6 +33,8 @@ def upgrade():
|
||||
for table, index, columns in INDEXES:
|
||||
if not inspector.has_table(table):
|
||||
continue
|
||||
if not set(columns) <= {column['name'] for column in inspector.get_columns(table)}:
|
||||
continue
|
||||
# Fresh installations create these indexes from ORM metadata before migrations.
|
||||
if index not in {item['name'] for item in inspector.get_indexes(table)}:
|
||||
op.create_index(index, table, columns)
|
||||
|
||||
Reference in New Issue
Block a user