From b685ad800fcfe451a2d0a26407ce73f2c4ec73d0 Mon Sep 17 00:00:00 2001 From: Luca Date: Sun, 12 May 2024 19:18:20 +0200 Subject: [PATCH] chore: add script to extract opt-in helpers from database dump --- scripts/extract_optin_helpers.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 scripts/extract_optin_helpers.sh diff --git a/scripts/extract_optin_helpers.sh b/scripts/extract_optin_helpers.sh new file mode 100755 index 0000000..667efd0 --- /dev/null +++ b/scripts/extract_optin_helpers.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +jq '[ + JOIN( + INDEX( + .[] | select( + .model == "app.helper" + ); + .pk | tostring + ); + .[] | select( + .model == "feedback.feedback" + and .fields.next_year + ); + .pk | tostring; + .[0].fields as $feedback + | .[1].fields as $helper + | { + "name": $helper.name, + "next_year": $feedback.next_year, + "phone": $helper.phone, + } + ) +]'