Skip to content

Commit

Permalink
fix: update migration script
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
dodumosu committed Sep 24, 2020
1 parent 7b10ce7 commit 876be3c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion migrations/versions/1e17be41a449_migrate_qa_expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ def upgrade():
fetch_query = sa.sql.text(
"SELECT id, quality_checks FROM form WHERE quality_checks IS NOT NULL OR quality_checks != 'null'::jsonb;") # noqa
form_table = Form.__table__
for form_id, quality_checks in op.execute(fetch_query).fetchall():
connection = op.get_bind()
for form_id, quality_checks in connection.execute(fetch_query).fetchall():
if not quality_checks:
continue
for quality_check in quality_checks:
if 'expression' not in quality_check:
quality_check['expression'] = qb.build_expression(
Expand Down

0 comments on commit 876be3c

Please sign in to comment.