From 33c625fff9081410bf85d42e80cc5c842db036bf Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Tue, 23 Apr 2024 10:13:46 +0100 Subject: [PATCH] chore: add new staging `team_integrations` columns to data sync script (#3042) --- scripts/seed-database/container.sh | 2 +- scripts/seed-database/write/team_integrations.sql | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/scripts/seed-database/container.sh b/scripts/seed-database/container.sh index e6e56cd635..c88dedb460 100755 --- a/scripts/seed-database/container.sh +++ b/scripts/seed-database/container.sh @@ -35,7 +35,7 @@ done # Copy subset of team_integrations columns # Do not copy production values -psql --quiet ${REMOTE_PG} --command="\\copy (SELECT id, team_id, staging_bops_submission_url, staging_bops_secret, has_planning_data, staging_govpay_secret FROM team_integrations) TO '/tmp/team_integrations.csv' (FORMAT csv, DELIMITER ';');" +psql --quiet ${REMOTE_PG} --command="\\copy (SELECT id, team_id, staging_bops_submission_url, staging_bops_secret, has_planning_data, staging_govpay_secret, staging_file_api_key, power_automate_webhook_url FROM team_integrations) TO '/tmp/team_integrations.csv' (FORMAT csv, DELIMITER ';');" echo team_integrations downloaded psql --quiet ${REMOTE_PG} --command="\\copy (SELECT DISTINCT ON (flow_id) id, data, flow_id, summary, publisher_id, created_at FROM published_flows ORDER BY flow_id, created_at DESC) TO '/tmp/published_flows.csv' (FORMAT csv, DELIMITER ';');" diff --git a/scripts/seed-database/write/team_integrations.sql b/scripts/seed-database/write/team_integrations.sql index 9eda3c21a5..c44ad9f1a8 100644 --- a/scripts/seed-database/write/team_integrations.sql +++ b/scripts/seed-database/write/team_integrations.sql @@ -5,20 +5,24 @@ CREATE TEMPORARY TABLE sync_team_integrations ( staging_bops_submission_url text, staging_bops_secret text, has_planning_data boolean, - staging_govpay_secret text + staging_govpay_secret text, + staging_file_api_key text, + power_automate_webhook_url text ); \COPY sync_team_integrations FROM '/tmp/team_integrations.csv' WITH (FORMAT csv, DELIMITER ';'); INSERT INTO - team_integrations (id, team_id, staging_bops_submission_url, staging_bops_secret, has_planning_data, staging_govpay_secret) + team_integrations (id, team_id, staging_bops_submission_url, staging_bops_secret, has_planning_data, staging_govpay_secret, staging_file_api_key, power_automate_webhook_url) SELECT id, team_id, staging_bops_submission_url, staging_bops_secret, has_planning_data, - staging_govpay_secret + staging_govpay_secret, + staging_file_api_key, + power_automate_webhook_url FROM sync_team_integrations ON CONFLICT (id) DO UPDATE @@ -27,7 +31,9 @@ SET staging_bops_submission_url = EXCLUDED.staging_bops_submission_url, staging_bops_secret = EXCLUDED.staging_bops_secret, has_planning_data = EXCLUDED.has_planning_data, - staging_govpay_secret = EXCLUDED.staging_govpay_secret; + staging_govpay_secret = EXCLUDED.staging_govpay_secret, + staging_file_api_key = EXCLUDED.staging_file_api_key, + power_automate_webhook_url = EXCLUDED.power_automate_webhook_url; SELECT setval('team_integrations_id_seq', max(id)) FROM