diff --git a/hasura.planx.uk/metadata/tables.yaml b/hasura.planx.uk/metadata/tables.yaml index 3e3e133aaa..5eaac0e3f0 100644 --- a/hasura.planx.uk/metadata/tables.yaml +++ b/hasura.planx.uk/metadata/tables.yaml @@ -1421,9 +1421,10 @@ columns: - id - team_id - - power_automate_api_key - production_bops_submission_url - staging_bops_submission_url + - production_power_automate_api_key + - staging_power_automate_api_key - has_planning_data - production_file_api_key - staging_file_api_key diff --git a/hasura.planx.uk/migrations/1714116722263_alter_table_public_team_integrations_alter_column_power_automate_api_key/down.sql b/hasura.planx.uk/migrations/1714116722263_alter_table_public_team_integrations_alter_column_power_automate_api_key/down.sql new file mode 100644 index 0000000000..580bcdd98c --- /dev/null +++ b/hasura.planx.uk/migrations/1714116722263_alter_table_public_team_integrations_alter_column_power_automate_api_key/down.sql @@ -0,0 +1 @@ +alter table "public"."team_integrations" rename column "staging_power_automate_api_key" to "power_automate_api_key"; diff --git a/hasura.planx.uk/migrations/1714116722263_alter_table_public_team_integrations_alter_column_power_automate_api_key/up.sql b/hasura.planx.uk/migrations/1714116722263_alter_table_public_team_integrations_alter_column_power_automate_api_key/up.sql new file mode 100644 index 0000000000..581ff6e063 --- /dev/null +++ b/hasura.planx.uk/migrations/1714116722263_alter_table_public_team_integrations_alter_column_power_automate_api_key/up.sql @@ -0,0 +1,5 @@ +alter table "public"."team_integrations" rename column "power_automate_api_key" to "staging_power_automate_api_key"; +comment on column "public"."team_integrations"."staging_power_automate_api_key" is E'API key used to make authorised requests to the Power Automate Webhook URL stored in the format :'; + +alter table "public"."team_integrations" add column "production_power_automate_api_key" text null; +comment on column "public"."team_integrations"."production_power_automate_api_key" is E'API key used to make authorised requests to the Power Automate Webhook URL stored in the format :'; diff --git a/scripts/seed-database/container.sh b/scripts/seed-database/container.sh index 0f3f255f0b..c3647b268c 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, staging_file_api_key, power_automate_webhook_url, power_automate_api_key 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, staging_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 ';');" diff --git a/scripts/seed-database/write/team_integrations.sql b/scripts/seed-database/write/team_integrations.sql index 411e1489fa..62ed3065a1 100644 --- a/scripts/seed-database/write/team_integrations.sql +++ b/scripts/seed-database/write/team_integrations.sql @@ -8,13 +8,13 @@ CREATE TEMPORARY TABLE sync_team_integrations ( staging_govpay_secret text, staging_file_api_key text, power_automate_webhook_url text, - power_automate_api_key text + staging_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, power_automate_api_key) + 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, staging_power_automate_api_key) SELECT id, team_id, @@ -24,7 +24,7 @@ SELECT staging_govpay_secret, staging_file_api_key, power_automate_webhook_url, - power_automate_api_key + staging_power_automate_api_key FROM sync_team_integrations ON CONFLICT (id) DO UPDATE @@ -36,7 +36,7 @@ SET 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_api_key = EXCLUDED.power_automate_api_key; + staging_power_automate_api_key = EXCLUDED.staging_power_automate_api_key; SELECT setval('team_integrations_id_seq', max(id)) FROM