From 505c8fe3ab7f33a0d5f405df334006cfef34f726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dafydd=20Ll=C5=B7r=20Pearson?= Date: Wed, 14 Feb 2024 10:38:15 +0000 Subject: [PATCH] chore: Sync govpay secrets [skip pizza] --- scripts/seed-database/container.sh | 2 +- scripts/seed-database/write/team_integrations.sql | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/seed-database/container.sh b/scripts/seed-database/container.sh index c3f3152738..e6e56cd635 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 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 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 44a433e756..9eda3c21a5 100644 --- a/scripts/seed-database/write/team_integrations.sql +++ b/scripts/seed-database/write/team_integrations.sql @@ -4,19 +4,21 @@ CREATE TEMPORARY TABLE sync_team_integrations ( team_id integer, staging_bops_submission_url text, staging_bops_secret text, - has_planning_data boolean + has_planning_data boolean, + staging_govpay_secret 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) + team_integrations (id, team_id, staging_bops_submission_url, staging_bops_secret, has_planning_data, staging_govpay_secret) SELECT id, team_id, staging_bops_submission_url, staging_bops_secret, - has_planning_data + has_planning_data, + staging_govpay_secret FROM sync_team_integrations ON CONFLICT (id) DO UPDATE @@ -24,7 +26,8 @@ SET team_id = EXCLUDED.team_id, staging_bops_submission_url = EXCLUDED.staging_bops_submission_url, staging_bops_secret = EXCLUDED.staging_bops_secret, - has_planning_data = EXCLUDED.has_planning_data; + has_planning_data = EXCLUDED.has_planning_data, + staging_govpay_secret = EXCLUDED.staging_govpay_secret; SELECT setval('team_integrations_id_seq', max(id)) FROM