Skip to content

Commit

Permalink
Merge pull request #1099 from guardian/aa/prisma-introspection
Browse files Browse the repository at this point in the history
fix(prisma): Updates after introspection
  • Loading branch information
akash1810 authored Jun 18, 2024
2 parents 9594a3a + 2303a7b commit a042f79
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 457 deletions.
25 changes: 13 additions & 12 deletions packages/common/prisma/views/public/aws_accounts.sql
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
SELECT
DISTINCT acc.id,
acc.name,
acc.email,
acc.status,
acc.joined_timestamp,
COALESCE(ou.name, 'ROOT' :: text) AS organizational_unit
fn_aws_accounts.id,
fn_aws_accounts.name,
fn_aws_accounts.email,
fn_aws_accounts.status,
fn_aws_accounts.joined_timestamp,
fn_aws_accounts.organizational_unit
FROM
(
(
aws_organizations_accounts acc
LEFT JOIN aws_organizations_account_parents par ON ((acc.id = par.id))
)
LEFT JOIN aws_organizations_organizational_units ou ON ((par.parent_id = ou.id))
fn_aws_accounts() fn_aws_accounts(
id,
name,
email,
STATUS,
joined_timestamp,
organizational_unit
);
320 changes: 0 additions & 320 deletions packages/common/prisma/views/public/view_aws_resources.sql

This file was deleted.

37 changes: 15 additions & 22 deletions packages/common/prisma/views/public/view_github_actions.sql
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
WITH data AS (
SELECT
tbl.evaluated_on,
tbl.full_name,
tbl.workflow_path,
use_string.use_string AS ACTION,
split_part(use_string.use_string, '@' :: text, 1) AS action_name,
split_part(use_string.use_string, '@' :: text, '-1' :: integer) AS version
FROM
guardian_github_actions_usage tbl,
LATERAL unnest(tbl.workflow_uses) use_string(use_string)
)
SELECT
d.evaluated_on,
d.full_name,
r.archived,
d.workflow_path,
d.action,
d.action_name,
d.version
fn_github_actions.evaluated_on,
fn_github_actions.full_name,
fn_github_actions.archived,
fn_github_actions.workflow_path,
fn_github_actions.action,
fn_github_actions.action_name,
fn_github_actions.version
FROM
(
data d
JOIN github_repositories r ON ((d.full_name = r.full_name))
fn_github_actions() fn_github_actions(
evaluated_on,
full_name,
archived,
workflow_path,
ACTION,
action_name,
version
);
Loading

0 comments on commit a042f79

Please sign in to comment.