Skip to content

Commit

Permalink
chore: update existing analytics_logs allow_list_answers to be an object
Browse files Browse the repository at this point in the history
- Convert from an array of objects to a single object
- Currently we have no records in prod where the [allow_list_answers is longer than 1](https://metabase.editor.planx.uk/question/354-number-of-analytics-logs-with-allow-list-answers-greater-than-1) so we can use this to convert
  • Loading branch information
Mike-Heneghan committed Mar 28, 2024
1 parent 98e59e7 commit 5d2cec6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
UPDATE public.analytics_logs
SET allow_list_answers = jsonb_build_array(allow_list_answers)
WHERE jsonb_typeof(allow_list_answers) != 'array';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
UPDATE public.analytics_logs
SET allow_list_answers = allow_list_answers->0
WHERE jsonb_typeof(allow_list_answers) = 'array' AND jsonb_array_length(allow_list_answers) = 1;

0 comments on commit 5d2cec6

Please sign in to comment.