From af2ebcc325045efc85051763b1b7d289787abd08 Mon Sep 17 00:00:00 2001 From: solopiu Date: Mon, 22 Nov 2021 15:06:48 +0100 Subject: [PATCH] fix schema --- .../redshift/20211122133558_create_deployments_view.up.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/migrations/redshift/20211122133558_create_deployments_view.up.sql b/configs/migrations/redshift/20211122133558_create_deployments_view.up.sql index eca44da..8558236 100644 --- a/configs/migrations/redshift/20211122133558_create_deployments_view.up.sql +++ b/configs/migrations/redshift/20211122133558_create_deployments_view.up.sql @@ -1,4 +1,4 @@ -CREATE VIEW deployments AS +CREATE VIEW watchops.deployments AS WITH deploys AS ( SELECT source, @@ -7,7 +7,7 @@ CREATE VIEW deployments AS CASE WHEN source like '%circleci%' then json_extract_path_text(json_serialize(metadata), 'workflow', 'id') WHEN source like '%github%' then json_extract_path_text(json_serialize(metadata), 'deployment', 'sha') WHEN source like '%gitlab%' then json_extract_path_text(json_serialize(metadata), 'commit', 'id') end as main_commit - FROM fourkeys.events_raw + FROM watchops.events_raw WHERE ((source like '%circleci%' and json_extract_path_text(json_serialize(metadata), 'status') = 'SUCCESS') OR (source like 'github%' and event_type = 'deployment_status' and json_extract_path_text(json_serialize(metadata), 'deployment_status', 'state') = 'success') OR (source like 'gitlab%' and event_type = 'pipeline' and json_extract_path_text(json_serialize(metadata), 'object_attributes', 'status') = 'success'))