IO-1345 IO-43 Related Job linking
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
- type: run_sql
|
||||
args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: DROP TABLE "public"."relatedjobs";
|
||||
@@ -0,0 +1,31 @@
|
||||
- type: run_sql
|
||||
args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
||||
- type: run_sql
|
||||
args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: |-
|
||||
CREATE TABLE "public"."relatedjobs"("id" uuid NOT NULL DEFAULT gen_random_uuid(), "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "parentjob" uuid NOT NULL, "childjob" UUID NOT NULL, PRIMARY KEY ("id") , FOREIGN KEY ("parentjob") REFERENCES "public"."jobs"("id") ON UPDATE cascade ON DELETE cascade, FOREIGN KEY ("childjob") REFERENCES "public"."jobs"("id") ON UPDATE cascade ON DELETE cascade, UNIQUE ("id"));
|
||||
CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
||||
RETURNS TRIGGER AS $$
|
||||
DECLARE
|
||||
_new record;
|
||||
BEGIN
|
||||
_new := NEW;
|
||||
_new."updated_at" = NOW();
|
||||
RETURN _new;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE TRIGGER "set_public_relatedjobs_updated_at"
|
||||
BEFORE UPDATE ON "public"."relatedjobs"
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
||||
COMMENT ON TRIGGER "set_public_relatedjobs_updated_at" ON "public"."relatedjobs"
|
||||
IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
||||
- type: add_existing_table_or_view
|
||||
args:
|
||||
name: relatedjobs
|
||||
schema: public
|
||||
@@ -0,0 +1,24 @@
|
||||
- type: drop_relationship
|
||||
args:
|
||||
relationship: relatedjobs
|
||||
table:
|
||||
name: jobs
|
||||
schema: public
|
||||
- type: drop_relationship
|
||||
args:
|
||||
relationship: relatedjobsByChildjob
|
||||
table:
|
||||
name: jobs
|
||||
schema: public
|
||||
- type: drop_relationship
|
||||
args:
|
||||
relationship: job
|
||||
table:
|
||||
name: relatedjobs
|
||||
schema: public
|
||||
- type: drop_relationship
|
||||
args:
|
||||
relationship: jobByChildjob
|
||||
table:
|
||||
name: relatedjobs
|
||||
schema: public
|
||||
@@ -0,0 +1,40 @@
|
||||
- type: create_array_relationship
|
||||
args:
|
||||
name: relatedjobs
|
||||
table:
|
||||
name: jobs
|
||||
schema: public
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
column: parentjob
|
||||
table:
|
||||
name: relatedjobs
|
||||
schema: public
|
||||
- type: create_array_relationship
|
||||
args:
|
||||
name: relatedjobsByChildjob
|
||||
table:
|
||||
name: jobs
|
||||
schema: public
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
column: childjob
|
||||
table:
|
||||
name: relatedjobs
|
||||
schema: public
|
||||
- type: create_object_relationship
|
||||
args:
|
||||
name: job
|
||||
table:
|
||||
name: relatedjobs
|
||||
schema: public
|
||||
using:
|
||||
foreign_key_constraint_on: parentjob
|
||||
- type: create_object_relationship
|
||||
args:
|
||||
name: jobByChildjob
|
||||
table:
|
||||
name: relatedjobs
|
||||
schema: public
|
||||
using:
|
||||
foreign_key_constraint_on: childjob
|
||||
@@ -0,0 +1,7 @@
|
||||
- type: rename_relationship
|
||||
args:
|
||||
name: parentjob_rel
|
||||
new_name: job
|
||||
table:
|
||||
name: relatedjobs
|
||||
schema: public
|
||||
@@ -0,0 +1,7 @@
|
||||
- type: rename_relationship
|
||||
args:
|
||||
name: job
|
||||
new_name: parentjob_rel
|
||||
table:
|
||||
name: relatedjobs
|
||||
schema: public
|
||||
@@ -0,0 +1,7 @@
|
||||
- type: rename_relationship
|
||||
args:
|
||||
name: childjob_rel
|
||||
new_name: jobByChildjob
|
||||
table:
|
||||
name: relatedjobs
|
||||
schema: public
|
||||
@@ -0,0 +1,7 @@
|
||||
- type: rename_relationship
|
||||
args:
|
||||
name: jobByChildjob
|
||||
new_name: childjob_rel
|
||||
table:
|
||||
name: relatedjobs
|
||||
schema: public
|
||||
@@ -0,0 +1,7 @@
|
||||
- type: rename_relationship
|
||||
args:
|
||||
name: relatedjobs_parent
|
||||
new_name: relatedjobs
|
||||
table:
|
||||
name: jobs
|
||||
schema: public
|
||||
@@ -0,0 +1,7 @@
|
||||
- type: rename_relationship
|
||||
args:
|
||||
name: relatedjobs
|
||||
new_name: relatedjobs_parent
|
||||
table:
|
||||
name: jobs
|
||||
schema: public
|
||||
@@ -0,0 +1,7 @@
|
||||
- type: rename_relationship
|
||||
args:
|
||||
name: relatedjobs_child
|
||||
new_name: relatedjobsByChildjob
|
||||
table:
|
||||
name: jobs
|
||||
schema: public
|
||||
@@ -0,0 +1,7 @@
|
||||
- type: rename_relationship
|
||||
args:
|
||||
name: relatedjobsByChildjob
|
||||
new_name: relatedjobs_child
|
||||
table:
|
||||
name: jobs
|
||||
schema: public
|
||||
@@ -0,0 +1,6 @@
|
||||
- type: drop_insert_permission
|
||||
args:
|
||||
role: user
|
||||
table:
|
||||
name: relatedjobs
|
||||
schema: public
|
||||
@@ -0,0 +1,36 @@
|
||||
- type: create_insert_permission
|
||||
args:
|
||||
permission:
|
||||
allow_upsert: true
|
||||
backend_only: false
|
||||
check:
|
||||
_or:
|
||||
- parentjob_rel:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
- childjob_rel:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
columns:
|
||||
- id
|
||||
- created_at
|
||||
- updated_at
|
||||
- parentjob
|
||||
- childjob
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: relatedjobs
|
||||
schema: public
|
||||
@@ -0,0 +1,6 @@
|
||||
- type: drop_select_permission
|
||||
args:
|
||||
role: user
|
||||
table:
|
||||
name: relatedjobs
|
||||
schema: public
|
||||
@@ -0,0 +1,37 @@
|
||||
- type: create_select_permission
|
||||
args:
|
||||
permission:
|
||||
allow_aggregations: false
|
||||
backend_only: false
|
||||
columns:
|
||||
- created_at
|
||||
- updated_at
|
||||
- childjob
|
||||
- id
|
||||
- parentjob
|
||||
computed_fields: []
|
||||
filter:
|
||||
_or:
|
||||
- parentjob_rel:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
- childjob_rel:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
limit: null
|
||||
role: user
|
||||
table:
|
||||
name: relatedjobs
|
||||
schema: public
|
||||
@@ -0,0 +1,6 @@
|
||||
- type: drop_update_permission
|
||||
args:
|
||||
role: user
|
||||
table:
|
||||
name: relatedjobs
|
||||
schema: public
|
||||
@@ -0,0 +1,35 @@
|
||||
- type: create_update_permission
|
||||
args:
|
||||
permission:
|
||||
backend_only: false
|
||||
columns:
|
||||
- created_at
|
||||
- updated_at
|
||||
- childjob
|
||||
- id
|
||||
- parentjob
|
||||
filter:
|
||||
_or:
|
||||
- parentjob_rel:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
- childjob_rel:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: relatedjobs
|
||||
schema: public
|
||||
@@ -0,0 +1,6 @@
|
||||
- type: drop_delete_permission
|
||||
args:
|
||||
role: user
|
||||
table:
|
||||
name: relatedjobs
|
||||
schema: public
|
||||
@@ -0,0 +1,28 @@
|
||||
- type: create_delete_permission
|
||||
args:
|
||||
permission:
|
||||
backend_only: false
|
||||
filter:
|
||||
_or:
|
||||
- parentjob_rel:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
- childjob_rel:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
role: user
|
||||
table:
|
||||
name: relatedjobs
|
||||
schema: public
|
||||
Reference in New Issue
Block a user