Aded joblines status view and updated graph to use the view. BOD-110

This commit is contained in:
Patrick Fic
2020-08-06 10:33:13 -07:00
parent bebdfe7a93
commit f383d78cda
35 changed files with 412 additions and 23 deletions

View File

@@ -0,0 +1 @@
[]

View File

@@ -0,0 +1,14 @@
- args:
cascade: true
read_only: false
sql: "CREATE OR REPLACE FUNCTION public.parts_status_by_job_id(jobid uuid)\n RETURNS
SETOF joblines\n LANGUAGE plpgsql\n STABLE\nAS $function$\n\nBEGIN\n if jobid
= '' then\n return query select status ,count(1), part_type from joblines
j group by status, part_type ;\n else \n return query select status ,count(1),
part_type from joblines j where j.jobid =jobid group by status, part_type;\n
\ end if;\n\n\tEND\n$function$;"
type: run_sql
- args:
name: parts_status_by_job_id
schema: public
type: track_function

View File

@@ -0,0 +1,10 @@
- args:
cascade: false
read_only: false
sql: "CREATE OR REPLACE FUNCTION public.parts_status_by_job_id(jobid uuid)\n RETURNS
SETOF joblines\n LANGUAGE plpgsql\n STABLE\nAS $function$\n\nBEGIN\n if jobid
= '' then\n return query select status ,count(1), part_type from joblines
j group by status, part_type ;\n else \n return query select status ,count(1),
part_type from joblines j where j.jobid =jobid group by status, part_type;\n
\ end if;\n\n\tEND\n$function$;"
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: DROP FUNCTION "public"."parts_status_by_job_id"("pg_catalog"."uuid");
type: run_sql

View File

@@ -0,0 +1 @@
[]

View File

@@ -0,0 +1,14 @@
- args:
cascade: true
read_only: false
sql: "CREATE OR REPLACE FUNCTION public.parts_status_by_job_id(jobid text)\n RETURNS
SETOF joblines\n LANGUAGE plpgsql\n STABLE\nAS $function$\n\nBEGIN\n if jobid
= '' then\n return query select status ,count(1), part_type from joblines
j group by status, part_type ;\n else \n return query select status ,count(1),
part_type from joblines j where j.jobid =jobid group by status, part_type;\n
\ end if;\n\n\tEND\n$function$;"
type: run_sql
- args:
name: parts_status_by_job_id
schema: public
type: track_function

View File

@@ -0,0 +1,10 @@
- args:
cascade: false
read_only: false
sql: "CREATE OR REPLACE FUNCTION public.parts_status_by_job_id(jobid text)\n RETURNS
SETOF joblines\n LANGUAGE plpgsql\n STABLE\nAS $function$\n\nBEGIN\n if jobid
= '' then\n return query select status ,count(1), part_type from joblines
j group by status, part_type ;\n else \n return query select status ,count(1),
part_type from joblines j where j.jobid =jobid group by status, part_type;\n
\ end if;\n\n\tEND\n$function$;"
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: DROP FUNCTION "public"."parts_status_by_job_id"("pg_catalog"."text");
type: run_sql

View File

@@ -0,0 +1 @@
[]

View File

@@ -0,0 +1,14 @@
- args:
cascade: true
read_only: false
sql: "CREATE OR REPLACE FUNCTION public.parts_status_by_job_id(jobIdVar text)\n
RETURNS SETOF joblines\n LANGUAGE plpgsql\n STABLE\nAS $function$\n\nBEGIN\n
\ if jobIdVar = '' then\n return query select status ,count(1), part_type
from joblines j group by status, part_type ;\n else \n return query select
status ,count(1), part_type from joblines j where j.jobid =jobIdVar group by
status, part_type;\n end if;\n\n\tEND\n$function$;"
type: run_sql
- args:
name: parts_status_by_job_id
schema: public
type: track_function

View File

@@ -0,0 +1,10 @@
- args:
cascade: false
read_only: false
sql: "CREATE OR REPLACE FUNCTION public.parts_status_by_job_id(jobidvar text)\n
RETURNS SETOF joblines\n LANGUAGE plpgsql\n STABLE\nAS $function$\n\nBEGIN\n
\ if jobIdVar = '' then\n return query select status ,count(1), part_type
from joblines j group by status, part_type ;\n else \n return query select
status ,count(1), part_type from joblines j where j.jobid =jobIdVar group by
status, part_type;\n end if;\n\n\tEND\n$function$;"
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: DROP FUNCTION "public"."parts_status_by_job_id"("pg_catalog"."text");
type: run_sql

View File

@@ -0,0 +1 @@
[]

View File

@@ -0,0 +1,14 @@
- args:
cascade: true
read_only: false
sql: "CREATE OR REPLACE FUNCTION public.parts_status_by_job_id(jobIdVar uuid)\n
RETURNS SETOF joblines\n LANGUAGE plpgsql\n STABLE\nAS $function$\n\nBEGIN\n
\ if jobIdVar = '' then\n return query select status ,count(1), part_type
from joblines j group by status, part_type ;\n else \n return query select
status ,count(1), part_type from joblines j where j.jobid =jobIdVar group by
status, part_type;\n end if;\n\n\tEND\n$function$;"
type: run_sql
- args:
name: parts_status_by_job_id
schema: public
type: track_function

View File

@@ -0,0 +1 @@
[]

View File

@@ -0,0 +1,8 @@
- args:
cascade: true
read_only: false
sql: "CREATE OR REPLACE FUNCTION public.parts_status_by_job_id(jobidvar uuid)\n
RETURNS SETOF joblines\n LANGUAGE plpgsql\n STABLE\nAS $function$\n\nBEGIN\n
\ \n return query select status ,count(1), part_type from joblines j where
j.jobid =jobIdVar group by status, part_type;\n\n\n\tEND\n$function$;"
type: run_sql

View File

@@ -0,0 +1 @@
[]

View File

@@ -0,0 +1,8 @@
- args:
cascade: true
read_only: false
sql: "CREATE OR REPLACE FUNCTION public.parts_status_by_job_id(jobidvar uuid)\n
RETURNS SETOF joblines\n LANGUAGE plpgsql\n STABLE\nAS $function$\n\nBEGIN\n
\ \n return query select status ,count(1), part_type from joblines j where
j.jobid =jobidvar group by status, part_type;\n\n\n\tEND\n$function$;"
type: run_sql

View File

@@ -0,0 +1,8 @@
- args:
cascade: false
read_only: false
sql: "CREATE OR REPLACE FUNCTION public.parts_status_by_job_id(jobidvar uuid)\n
RETURNS SETOF joblines\n LANGUAGE plpgsql\n STABLE\nAS $function$\n\nBEGIN\n
\ \n return query select status ,count(1), part_type from joblines j where
j.jobid =jobidvar group by status, part_type;\n\n\n\tEND\n$function$;"
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: DROP FUNCTION "public"."parts_status_by_job_id"("pg_catalog"."uuid");
type: run_sql

View File

@@ -0,0 +1 @@
[]

View File

@@ -0,0 +1,10 @@
- args:
cascade: true
read_only: false
sql: create view joblines_stats as select jobid, status ,count(1), part_type
from joblines j group by jobid, status, part_type ;
type: run_sql
- args:
name: joblines_stats
schema: public
type: add_existing_table_or_view

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: alter view "public"."joblines_status" rename to "joblines_stats";
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: alter view "public"."joblines_stats" rename to "joblines_status";
type: run_sql

View File

@@ -0,0 +1,6 @@
- args:
relationship: job
table:
name: joblines_status
schema: public
type: drop_relationship

View File

@@ -0,0 +1,13 @@
- args:
name: job
table:
name: joblines_status
schema: public
using:
manual_configuration:
column_mapping:
jobid: id
remote_table:
name: jobs
schema: public
type: create_object_relationship

View File

@@ -0,0 +1,6 @@
- args:
relationship: joblines_status
table:
name: jobs
schema: public
type: drop_relationship

View File

@@ -0,0 +1,13 @@
- args:
name: joblines_status
table:
name: jobs
schema: public
using:
manual_configuration:
column_mapping:
id: jobid
remote_table:
name: joblines_status
schema: public
type: create_array_relationship

View File

@@ -0,0 +1,6 @@
- args:
role: user
table:
name: joblines_status
schema: public
type: drop_select_permission

View File

@@ -0,0 +1,26 @@
- args:
permission:
allow_aggregations: false
backend_only: false
columns:
- jobid
- status
- count
- part_type
computed_fields: []
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
limit: null
role: user
table:
name: joblines_status
schema: public
type: create_select_permission

View File

@@ -1891,6 +1891,36 @@ tables:
_eq: X-Hasura-User-Id
- active:
_eq: true
- table:
schema: public
name: joblines_status
object_relationships:
- name: job
using:
manual_configuration:
remote_table:
schema: public
name: jobs
column_mapping:
jobid: id
select_permissions:
- role: user
permission:
columns:
- jobid
- status
- count
- part_type
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
- table:
schema: public
name: jobs
@@ -1978,6 +2008,14 @@ tables:
table:
schema: public
name: joblines
- name: joblines_status
using:
manual_configuration:
remote_table:
schema: public
name: joblines_status
column_mapping:
id: jobid
- name: notes
using:
foreign_key_constraint_on: