Skip to content

Commit

Permalink
chore: add team_integrations.power_automate_api_key column (#3053)
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak authored Apr 24, 2024
1 parent b93f87c commit e63b0bf
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
15 changes: 8 additions & 7 deletions hasura.planx.uk/metadata/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1419,18 +1419,19 @@
- role: api
permission:
columns:
- has_planning_data
- id
- power_automate_webhook_url
- production_bops_secret
- team_id
- power_automate_api_key
- production_bops_submission_url
- production_file_api_key
- production_govpay_secret
- staging_bops_secret
- staging_bops_submission_url
- has_planning_data
- production_file_api_key
- staging_file_api_key
- production_bops_secret
- staging_bops_secret
- production_govpay_secret
- staging_govpay_secret
- team_id
- power_automate_webhook_url
filter: {}
- role: public
permission:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table "public"."team_integrations"
drop column "power_automate_api_key";
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table "public"."team_integrations" add column "power_automate_api_key" text null;
comment on column "public"."team_integrations"."power_automate_api_key" is E'API key used to make authorised requests to the Power Automate Webhook URL stored in the format <API_KEY>:<INITIALIZATION_VECTOR>';
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, staging_govpay_secret, staging_file_api_key, power_automate_webhook_url 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, power_automate_api_key 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 @@ -7,13 +7,14 @@ CREATE TEMPORARY TABLE sync_team_integrations (
has_planning_data boolean,
staging_govpay_secret text,
staging_file_api_key text,
power_automate_webhook_url text
power_automate_webhook_url text,
power_automate_api_key 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, staging_file_api_key, power_automate_webhook_url)
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, power_automate_api_key)
SELECT
id,
team_id,
Expand All @@ -22,7 +23,8 @@ SELECT
has_planning_data,
staging_govpay_secret,
staging_file_api_key,
power_automate_webhook_url
power_automate_webhook_url,
power_automate_api_key
FROM
sync_team_integrations ON CONFLICT (id) DO
UPDATE
Expand All @@ -33,7 +35,8 @@ SET
has_planning_data = EXCLUDED.has_planning_data,
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;
power_automate_webhook_url = EXCLUDED.power_automate_webhook_url,
power_automate_api_key = EXCLUDED.power_automate_api_key;
SELECT
setval('team_integrations_id_seq', max(id))
FROM
Expand Down

0 comments on commit e63b0bf

Please sign in to comment.