Skip to content

Commit

Permalink
chore: Sync govpay secrets [skip pizza]
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Feb 14, 2024
1 parent 6916c32 commit 505c8fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scripts/seed-database/container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ';');"
Expand Down
11 changes: 7 additions & 4 deletions scripts/seed-database/write/team_integrations.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,30 @@ 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
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
Expand Down

0 comments on commit 505c8fe

Please sign in to comment.