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'))