Skip to content

Commit 9145ce5

Browse files
committed
fix: update migration script
- this commit fixes an issue with the migration script where the user receives an `AttributeError` while running it - it also doesn't assume that QA is present on the form
1 parent 0d9b0ad commit 9145ce5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

migrations/versions/1e17be41a449_migrate_qa_expressions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ def upgrade():
2222
fetch_query = sa.sql.text(
2323
"SELECT id, quality_checks FROM form WHERE quality_checks IS NOT NULL OR quality_checks != 'null'::jsonb;") # noqa
2424
form_table = Form.__table__
25-
for form_id, quality_checks in op.execute(fetch_query).fetchall():
25+
connection = op.get_bind()
26+
for form_id, quality_checks in connection.execute(fetch_query).fetchall():
27+
if not quality_checks:
28+
continue
2629
for quality_check in quality_checks:
2730
if 'expression' not in quality_check:
2831
quality_check['expression'] = qb.build_expression(

0 commit comments

Comments
 (0)