BOD-16 Courtesy Car Schema Changes
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
- args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: DROP TABLE "public"."courtesycars";
|
||||
type: run_sql
|
||||
@@ -0,0 +1,31 @@
|
||||
- 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\".\"courtesycars\"(\"id\" uuid NOT NULL DEFAULT gen_random_uuid(),
|
||||
\"created_at\" timestamptz NOT NULL DEFAULT now(), \"updated_at\" timestamptz
|
||||
NOT NULL DEFAULT now(), \"bodyshopid\" uuid NOT NULL, \"make\" text NOT NULL,
|
||||
\"model\" text NOT NULL, \"year\" text NOT NULL, \"plate\" text NOT NULL, \"color\"
|
||||
text NOT NULL, \"vin\" text NOT NULL, \"fleetnumber\" text, \"purchasedate\"
|
||||
date, \"servicestartdate\" date, \"serviceenddate\" date, \"leaseenddate\" date,
|
||||
\"status\" text NOT NULL DEFAULT 'Available', \"NextServiceKm\" numeric NOT
|
||||
NULL DEFAULT 0, \"NextServiceDate\" date, \"Damage\" text, \"Notes\" text, \"fuel\"
|
||||
numeric NOT NULL DEFAULT 1, \"registrationexpires\" date, \"insuranceexpires\"
|
||||
date, \"dailycost\" numeric NOT NULL DEFAULT 0, PRIMARY KEY (\"id\") , FOREIGN
|
||||
KEY (\"bodyshopid\") REFERENCES \"public\".\"bodyshops\"(\"id\") ON UPDATE restrict
|
||||
ON DELETE restrict);\nCREATE OR REPLACE FUNCTION \"public\".\"set_current_timestamp_updated_at\"()\nRETURNS
|
||||
TRIGGER AS $$\nDECLARE\n _new record;\nBEGIN\n _new := NEW;\n _new.\"updated_at\"
|
||||
= NOW();\n RETURN _new;\nEND;\n$$ LANGUAGE plpgsql;\nCREATE TRIGGER \"set_public_courtesycars_updated_at\"\nBEFORE
|
||||
UPDATE ON \"public\".\"courtesycars\"\nFOR EACH ROW\nEXECUTE PROCEDURE \"public\".\"set_current_timestamp_updated_at\"();\nCOMMENT
|
||||
ON TRIGGER \"set_public_courtesycars_updated_at\" ON \"public\".\"courtesycars\"
|
||||
\nIS 'trigger to set value of column \"updated_at\" to current timestamp on
|
||||
row update';"
|
||||
type: run_sql
|
||||
- args:
|
||||
name: courtesycars
|
||||
schema: public
|
||||
type: add_existing_table_or_view
|
||||
@@ -0,0 +1,12 @@
|
||||
- args:
|
||||
relationship: courtesycars
|
||||
table:
|
||||
name: bodyshops
|
||||
schema: public
|
||||
type: drop_relationship
|
||||
- args:
|
||||
relationship: bodyshop
|
||||
table:
|
||||
name: courtesycars
|
||||
schema: public
|
||||
type: drop_relationship
|
||||
@@ -0,0 +1,20 @@
|
||||
- args:
|
||||
name: courtesycars
|
||||
table:
|
||||
name: bodyshops
|
||||
schema: public
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
column: bodyshopid
|
||||
table:
|
||||
name: courtesycars
|
||||
schema: public
|
||||
type: create_array_relationship
|
||||
- args:
|
||||
name: bodyshop
|
||||
table:
|
||||
name: courtesycars
|
||||
schema: public
|
||||
using:
|
||||
foreign_key_constraint_on: bodyshopid
|
||||
type: create_object_relationship
|
||||
@@ -0,0 +1,5 @@
|
||||
- args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: DROP TABLE "public"."cccontract";
|
||||
type: run_sql
|
||||
@@ -0,0 +1,33 @@
|
||||
- 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\".\"cccontract\"(\"id\" uuid NOT NULL DEFAULT gen_random_uuid(),
|
||||
\"created_at\" timestamptz NOT NULL DEFAULT now(), \"updated_at\" timestamptz
|
||||
NOT NULL DEFAULT now(), \"agreementnumber\" serial NOT NULL, \"courtesycarid\"
|
||||
uuid NOT NULL, \"jobid\" uuid NOT NULL, \"status\" text NOT NULL DEFAULT 'Reserved',
|
||||
\"start\" date, \"scheduledreturn\" date, \"actualreturn\" date, \"kmstart\"
|
||||
numeric NOT NULL, \"kmend\" numeric, \"driver_dlnumber\" text NOT NULL, \"driver_dlexpiry\"
|
||||
date NOT NULL, \"driver_dlst\" text NOT NULL, \"driver_fn\" text NOT NULL, \"driver_ln\"
|
||||
text NOT NULL, \"driver_addr1\" text NOT NULL, \"driver_addr2\" text, \"driver_city\"
|
||||
text NOT NULL, \"driver_state\" text NOT NULL, \"driver_zip\" text NOT NULL,
|
||||
\"driver_ph1\" text NOT NULL, \"driver_dob\" date NOT NULL, \"cc_num\" text,
|
||||
\"cc_expiry\" text, \"cc_cardholder\" text, PRIMARY KEY (\"id\") , FOREIGN KEY
|
||||
(\"courtesycarid\") REFERENCES \"public\".\"courtesycars\"(\"id\") ON UPDATE
|
||||
restrict ON DELETE restrict, FOREIGN KEY (\"jobid\") REFERENCES \"public\".\"jobs\"(\"id\")
|
||||
ON UPDATE restrict ON DELETE restrict);\nCREATE OR REPLACE FUNCTION \"public\".\"set_current_timestamp_updated_at\"()\nRETURNS
|
||||
TRIGGER AS $$\nDECLARE\n _new record;\nBEGIN\n _new := NEW;\n _new.\"updated_at\"
|
||||
= NOW();\n RETURN _new;\nEND;\n$$ LANGUAGE plpgsql;\nCREATE TRIGGER \"set_public_cccontract_updated_at\"\nBEFORE
|
||||
UPDATE ON \"public\".\"cccontract\"\nFOR EACH ROW\nEXECUTE PROCEDURE \"public\".\"set_current_timestamp_updated_at\"();\nCOMMENT
|
||||
ON TRIGGER \"set_public_cccontract_updated_at\" ON \"public\".\"cccontract\"
|
||||
\nIS 'trigger to set value of column \"updated_at\" to current timestamp on
|
||||
row update';"
|
||||
type: run_sql
|
||||
- args:
|
||||
name: cccontract
|
||||
schema: public
|
||||
type: add_existing_table_or_view
|
||||
@@ -0,0 +1,24 @@
|
||||
- args:
|
||||
relationship: job
|
||||
table:
|
||||
name: cccontract
|
||||
schema: public
|
||||
type: drop_relationship
|
||||
- args:
|
||||
relationship: courtesycar
|
||||
table:
|
||||
name: cccontract
|
||||
schema: public
|
||||
type: drop_relationship
|
||||
- args:
|
||||
relationship: cccontracts
|
||||
table:
|
||||
name: courtesycars
|
||||
schema: public
|
||||
type: drop_relationship
|
||||
- args:
|
||||
relationship: cccontracts
|
||||
table:
|
||||
name: jobs
|
||||
schema: public
|
||||
type: drop_relationship
|
||||
@@ -0,0 +1,40 @@
|
||||
- args:
|
||||
name: job
|
||||
table:
|
||||
name: cccontract
|
||||
schema: public
|
||||
using:
|
||||
foreign_key_constraint_on: jobid
|
||||
type: create_object_relationship
|
||||
- args:
|
||||
name: courtesycar
|
||||
table:
|
||||
name: cccontract
|
||||
schema: public
|
||||
using:
|
||||
foreign_key_constraint_on: courtesycarid
|
||||
type: create_object_relationship
|
||||
- args:
|
||||
name: cccontracts
|
||||
table:
|
||||
name: courtesycars
|
||||
schema: public
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
column: courtesycarid
|
||||
table:
|
||||
name: cccontract
|
||||
schema: public
|
||||
type: create_array_relationship
|
||||
- args:
|
||||
name: cccontracts
|
||||
table:
|
||||
name: jobs
|
||||
schema: public
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
column: jobid
|
||||
table:
|
||||
name: cccontract
|
||||
schema: public
|
||||
type: create_array_relationship
|
||||
@@ -0,0 +1,6 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: courtesycars
|
||||
schema: public
|
||||
type: drop_insert_permission
|
||||
@@ -0,0 +1,46 @@
|
||||
- args:
|
||||
permission:
|
||||
allow_upsert: true
|
||||
check:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
columns:
|
||||
- id
|
||||
- created_at
|
||||
- updated_at
|
||||
- bodyshopid
|
||||
- make
|
||||
- model
|
||||
- year
|
||||
- plate
|
||||
- color
|
||||
- vin
|
||||
- fleetnumber
|
||||
- purchasedate
|
||||
- servicestartdate
|
||||
- serviceenddate
|
||||
- leaseenddate
|
||||
- status
|
||||
- NextServiceKm
|
||||
- NextServiceDate
|
||||
- Damage
|
||||
- Notes
|
||||
- fuel
|
||||
- registrationexpires
|
||||
- insuranceexpires
|
||||
- dailycost
|
||||
localPresets:
|
||||
- key: ""
|
||||
value: ""
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: courtesycars
|
||||
schema: public
|
||||
type: create_insert_permission
|
||||
@@ -0,0 +1,6 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: courtesycars
|
||||
schema: public
|
||||
type: drop_select_permission
|
||||
@@ -0,0 +1,44 @@
|
||||
- args:
|
||||
permission:
|
||||
allow_aggregations: false
|
||||
columns:
|
||||
- insuranceexpires
|
||||
- leaseenddate
|
||||
- NextServiceDate
|
||||
- purchasedate
|
||||
- registrationexpires
|
||||
- serviceenddate
|
||||
- servicestartdate
|
||||
- dailycost
|
||||
- fuel
|
||||
- NextServiceKm
|
||||
- color
|
||||
- Damage
|
||||
- fleetnumber
|
||||
- make
|
||||
- model
|
||||
- Notes
|
||||
- plate
|
||||
- status
|
||||
- vin
|
||||
- year
|
||||
- created_at
|
||||
- updated_at
|
||||
- bodyshopid
|
||||
- id
|
||||
computed_fields: []
|
||||
filter:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
limit: null
|
||||
role: user
|
||||
table:
|
||||
name: courtesycars
|
||||
schema: public
|
||||
type: create_select_permission
|
||||
@@ -0,0 +1,6 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: courtesycars
|
||||
schema: public
|
||||
type: drop_update_permission
|
||||
@@ -0,0 +1,45 @@
|
||||
- args:
|
||||
permission:
|
||||
columns:
|
||||
- insuranceexpires
|
||||
- leaseenddate
|
||||
- NextServiceDate
|
||||
- purchasedate
|
||||
- registrationexpires
|
||||
- serviceenddate
|
||||
- servicestartdate
|
||||
- dailycost
|
||||
- fuel
|
||||
- NextServiceKm
|
||||
- color
|
||||
- Damage
|
||||
- fleetnumber
|
||||
- make
|
||||
- model
|
||||
- Notes
|
||||
- plate
|
||||
- status
|
||||
- vin
|
||||
- year
|
||||
- created_at
|
||||
- updated_at
|
||||
- bodyshopid
|
||||
- id
|
||||
filter:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
localPresets:
|
||||
- key: ""
|
||||
value: ""
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: courtesycars
|
||||
schema: public
|
||||
type: create_update_permission
|
||||
@@ -0,0 +1,6 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: courtesycars
|
||||
schema: public
|
||||
type: drop_delete_permission
|
||||
@@ -0,0 +1,16 @@
|
||||
- args:
|
||||
permission:
|
||||
filter:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
role: user
|
||||
table:
|
||||
name: courtesycars
|
||||
schema: public
|
||||
type: create_delete_permission
|
||||
@@ -0,0 +1,5 @@
|
||||
- args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: alter table "public"."cccontracts" rename to "cccontract";
|
||||
type: run_sql
|
||||
@@ -0,0 +1,5 @@
|
||||
- args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: alter table "public"."cccontract" rename to "cccontracts";
|
||||
type: run_sql
|
||||
@@ -0,0 +1,6 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: cccontracts
|
||||
schema: public
|
||||
type: drop_insert_permission
|
||||
@@ -0,0 +1,50 @@
|
||||
- args:
|
||||
permission:
|
||||
allow_upsert: true
|
||||
check:
|
||||
courtesycar:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
columns:
|
||||
- id
|
||||
- created_at
|
||||
- updated_at
|
||||
- agreementnumber
|
||||
- courtesycarid
|
||||
- jobid
|
||||
- status
|
||||
- start
|
||||
- scheduledreturn
|
||||
- actualreturn
|
||||
- kmstart
|
||||
- kmend
|
||||
- driver_dlnumber
|
||||
- driver_dlexpiry
|
||||
- driver_dlst
|
||||
- driver_fn
|
||||
- driver_ln
|
||||
- driver_addr1
|
||||
- driver_addr2
|
||||
- driver_city
|
||||
- driver_state
|
||||
- driver_zip
|
||||
- driver_ph1
|
||||
- driver_dob
|
||||
- cc_num
|
||||
- cc_expiry
|
||||
- cc_cardholder
|
||||
localPresets:
|
||||
- key: ""
|
||||
value: ""
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: cccontracts
|
||||
schema: public
|
||||
type: create_insert_permission
|
||||
@@ -0,0 +1,6 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: cccontracts
|
||||
schema: public
|
||||
type: drop_select_permission
|
||||
@@ -0,0 +1,48 @@
|
||||
- args:
|
||||
permission:
|
||||
allow_aggregations: false
|
||||
columns:
|
||||
- actualreturn
|
||||
- driver_dlexpiry
|
||||
- driver_dob
|
||||
- scheduledreturn
|
||||
- start
|
||||
- agreementnumber
|
||||
- kmend
|
||||
- kmstart
|
||||
- cc_cardholder
|
||||
- cc_expiry
|
||||
- cc_num
|
||||
- driver_addr1
|
||||
- driver_addr2
|
||||
- driver_city
|
||||
- driver_dlnumber
|
||||
- driver_dlst
|
||||
- driver_fn
|
||||
- driver_ln
|
||||
- driver_ph1
|
||||
- driver_state
|
||||
- driver_zip
|
||||
- status
|
||||
- created_at
|
||||
- updated_at
|
||||
- courtesycarid
|
||||
- id
|
||||
- jobid
|
||||
computed_fields: []
|
||||
filter:
|
||||
courtesycar:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
limit: null
|
||||
role: user
|
||||
table:
|
||||
name: cccontracts
|
||||
schema: public
|
||||
type: create_select_permission
|
||||
@@ -0,0 +1,6 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: cccontracts
|
||||
schema: public
|
||||
type: drop_update_permission
|
||||
@@ -0,0 +1,49 @@
|
||||
- args:
|
||||
permission:
|
||||
columns:
|
||||
- actualreturn
|
||||
- driver_dlexpiry
|
||||
- driver_dob
|
||||
- scheduledreturn
|
||||
- start
|
||||
- agreementnumber
|
||||
- kmend
|
||||
- kmstart
|
||||
- cc_cardholder
|
||||
- cc_expiry
|
||||
- cc_num
|
||||
- driver_addr1
|
||||
- driver_addr2
|
||||
- driver_city
|
||||
- driver_dlnumber
|
||||
- driver_dlst
|
||||
- driver_fn
|
||||
- driver_ln
|
||||
- driver_ph1
|
||||
- driver_state
|
||||
- driver_zip
|
||||
- status
|
||||
- created_at
|
||||
- updated_at
|
||||
- courtesycarid
|
||||
- id
|
||||
- jobid
|
||||
filter:
|
||||
courtesycar:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
localPresets:
|
||||
- key: ""
|
||||
value: ""
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: cccontracts
|
||||
schema: public
|
||||
type: create_update_permission
|
||||
@@ -0,0 +1,6 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: cccontracts
|
||||
schema: public
|
||||
type: drop_delete_permission
|
||||
@@ -0,0 +1,17 @@
|
||||
- args:
|
||||
permission:
|
||||
filter:
|
||||
courtesycar:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
role: user
|
||||
table:
|
||||
name: cccontracts
|
||||
schema: public
|
||||
type: create_delete_permission
|
||||
Reference in New Issue
Block a user