From 3b572173ba77b7e5ecbc28780b624a80391a2de9 Mon Sep 17 00:00:00 2001 From: Paul Bugni Date: Mon, 25 Nov 2024 17:43:29 -0800 Subject: [PATCH] IRONN-264 remove research_data rows with translated timepoints for correction on next cache_research_data() run --- portal/migrations/versions/4f5daa2b48db_.py | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 portal/migrations/versions/4f5daa2b48db_.py diff --git a/portal/migrations/versions/4f5daa2b48db_.py b/portal/migrations/versions/4f5daa2b48db_.py new file mode 100644 index 000000000..31246e664 --- /dev/null +++ b/portal/migrations/versions/4f5daa2b48db_.py @@ -0,0 +1,24 @@ +"""remove non english rows from report data (IRONN-264) + +Revision ID: 4f5daa2b48db +Revises: 967a074a0404 +Create Date: 2024-11-25 13:48:01.321510 + +""" +from alembic import op + + +# revision identifiers, used by Alembic. +revision = '4f5daa2b48db' +down_revision = '967a074a0404' + + +def upgrade(): + connection = op.get_bind() + connection.execute("DELETE FROM research_data WHERE NOT (data->>'timepoint' ~ '^(Baseline|Month)');") + # next run of `cache_research_data()` will pick up those just deleted. + + +def downgrade(): + # no point in bringing those back + pass