Skip to content

Commit a95eef6

Browse files
committed
Fix missing Translator model in upgrade step
1 parent 0eef94f commit a95eef6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/onegov/search/upgrade.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from onegov.core.upgrade import upgrade_task, UpgradeContext
99
from onegov.search.utils import searchable_sqlalchemy_models
10+
from onegov.translator_directory.models.translator import Translator
1011

1112

1213
@upgrade_task('Adds fts index column to all searchable models')
@@ -30,11 +31,15 @@ def adds_index_data_columns(context: UpgradeContext) -> None:
3031

3132
@upgrade_task('Adds fts data column (json) to all searchable models')
3233
def adds_fts_index_data_column(context: UpgradeContext) -> None:
33-
models = (
34+
models = [
3435
model
3536
for base in context.app.session_manager.bases
3637
for model in searchable_sqlalchemy_models(base)
37-
)
38+
]
39+
40+
# I observed that the Translator model may not included in the models list
41+
models.append(Translator) if Translator not in models else None
42+
3843
for model in models:
3944
assert hasattr(model, '__tablename__')
4045
if not context.has_column(model.__tablename__, 'fts_idx_data'):

0 commit comments

Comments
 (0)