diff --git a/hasura/migrations/1585594344847_create_table_public_courtesycars/down.yaml b/hasura/migrations/1585594344847_create_table_public_courtesycars/down.yaml new file mode 100644 index 000000000..486ffa454 --- /dev/null +++ b/hasura/migrations/1585594344847_create_table_public_courtesycars/down.yaml @@ -0,0 +1,5 @@ +- args: + cascade: false + read_only: false + sql: DROP TABLE "public"."courtesycars"; + type: run_sql diff --git a/hasura/migrations/1585594344847_create_table_public_courtesycars/up.yaml b/hasura/migrations/1585594344847_create_table_public_courtesycars/up.yaml new file mode 100644 index 000000000..d015903ef --- /dev/null +++ b/hasura/migrations/1585594344847_create_table_public_courtesycars/up.yaml @@ -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 diff --git a/hasura/migrations/1585594392845_track_all_relationships/down.yaml b/hasura/migrations/1585594392845_track_all_relationships/down.yaml new file mode 100644 index 000000000..b76d03b9e --- /dev/null +++ b/hasura/migrations/1585594392845_track_all_relationships/down.yaml @@ -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 diff --git a/hasura/migrations/1585594392845_track_all_relationships/up.yaml b/hasura/migrations/1585594392845_track_all_relationships/up.yaml new file mode 100644 index 000000000..d7f2ac72c --- /dev/null +++ b/hasura/migrations/1585594392845_track_all_relationships/up.yaml @@ -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 diff --git a/hasura/migrations/1585595056116_create_table_public_cccontract/down.yaml b/hasura/migrations/1585595056116_create_table_public_cccontract/down.yaml new file mode 100644 index 000000000..6d3ed3f08 --- /dev/null +++ b/hasura/migrations/1585595056116_create_table_public_cccontract/down.yaml @@ -0,0 +1,5 @@ +- args: + cascade: false + read_only: false + sql: DROP TABLE "public"."cccontract"; + type: run_sql diff --git a/hasura/migrations/1585595056116_create_table_public_cccontract/up.yaml b/hasura/migrations/1585595056116_create_table_public_cccontract/up.yaml new file mode 100644 index 000000000..829a34352 --- /dev/null +++ b/hasura/migrations/1585595056116_create_table_public_cccontract/up.yaml @@ -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 diff --git a/hasura/migrations/1585595063336_track_all_relationships/down.yaml b/hasura/migrations/1585595063336_track_all_relationships/down.yaml new file mode 100644 index 000000000..962ae6974 --- /dev/null +++ b/hasura/migrations/1585595063336_track_all_relationships/down.yaml @@ -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 diff --git a/hasura/migrations/1585595063336_track_all_relationships/up.yaml b/hasura/migrations/1585595063336_track_all_relationships/up.yaml new file mode 100644 index 000000000..74a477e62 --- /dev/null +++ b/hasura/migrations/1585595063336_track_all_relationships/up.yaml @@ -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 diff --git a/hasura/migrations/1585595095297_update_permission_user_public_table_courtesycars/down.yaml b/hasura/migrations/1585595095297_update_permission_user_public_table_courtesycars/down.yaml new file mode 100644 index 000000000..1ece918dc --- /dev/null +++ b/hasura/migrations/1585595095297_update_permission_user_public_table_courtesycars/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: courtesycars + schema: public + type: drop_insert_permission diff --git a/hasura/migrations/1585595095297_update_permission_user_public_table_courtesycars/up.yaml b/hasura/migrations/1585595095297_update_permission_user_public_table_courtesycars/up.yaml new file mode 100644 index 000000000..cb10d2c0c --- /dev/null +++ b/hasura/migrations/1585595095297_update_permission_user_public_table_courtesycars/up.yaml @@ -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 diff --git a/hasura/migrations/1585595102086_update_permission_user_public_table_courtesycars/down.yaml b/hasura/migrations/1585595102086_update_permission_user_public_table_courtesycars/down.yaml new file mode 100644 index 000000000..cef7281aa --- /dev/null +++ b/hasura/migrations/1585595102086_update_permission_user_public_table_courtesycars/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: courtesycars + schema: public + type: drop_select_permission diff --git a/hasura/migrations/1585595102086_update_permission_user_public_table_courtesycars/up.yaml b/hasura/migrations/1585595102086_update_permission_user_public_table_courtesycars/up.yaml new file mode 100644 index 000000000..1c9b059d7 --- /dev/null +++ b/hasura/migrations/1585595102086_update_permission_user_public_table_courtesycars/up.yaml @@ -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 diff --git a/hasura/migrations/1585595106910_update_permission_user_public_table_courtesycars/down.yaml b/hasura/migrations/1585595106910_update_permission_user_public_table_courtesycars/down.yaml new file mode 100644 index 000000000..9605986fe --- /dev/null +++ b/hasura/migrations/1585595106910_update_permission_user_public_table_courtesycars/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: courtesycars + schema: public + type: drop_update_permission diff --git a/hasura/migrations/1585595106910_update_permission_user_public_table_courtesycars/up.yaml b/hasura/migrations/1585595106910_update_permission_user_public_table_courtesycars/up.yaml new file mode 100644 index 000000000..c49fddd2f --- /dev/null +++ b/hasura/migrations/1585595106910_update_permission_user_public_table_courtesycars/up.yaml @@ -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 diff --git a/hasura/migrations/1585595111087_update_permission_user_public_table_courtesycars/down.yaml b/hasura/migrations/1585595111087_update_permission_user_public_table_courtesycars/down.yaml new file mode 100644 index 000000000..b63edce8f --- /dev/null +++ b/hasura/migrations/1585595111087_update_permission_user_public_table_courtesycars/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: courtesycars + schema: public + type: drop_delete_permission diff --git a/hasura/migrations/1585595111087_update_permission_user_public_table_courtesycars/up.yaml b/hasura/migrations/1585595111087_update_permission_user_public_table_courtesycars/up.yaml new file mode 100644 index 000000000..e133c026e --- /dev/null +++ b/hasura/migrations/1585595111087_update_permission_user_public_table_courtesycars/up.yaml @@ -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 diff --git a/hasura/migrations/1585595120824_rename_table_public_cccontract/down.yaml b/hasura/migrations/1585595120824_rename_table_public_cccontract/down.yaml new file mode 100644 index 000000000..ad3fde467 --- /dev/null +++ b/hasura/migrations/1585595120824_rename_table_public_cccontract/down.yaml @@ -0,0 +1,5 @@ +- args: + cascade: false + read_only: false + sql: alter table "public"."cccontracts" rename to "cccontract"; + type: run_sql diff --git a/hasura/migrations/1585595120824_rename_table_public_cccontract/up.yaml b/hasura/migrations/1585595120824_rename_table_public_cccontract/up.yaml new file mode 100644 index 000000000..53412a34a --- /dev/null +++ b/hasura/migrations/1585595120824_rename_table_public_cccontract/up.yaml @@ -0,0 +1,5 @@ +- args: + cascade: false + read_only: false + sql: alter table "public"."cccontract" rename to "cccontracts"; + type: run_sql diff --git a/hasura/migrations/1585595169060_update_permission_user_public_table_cccontracts/down.yaml b/hasura/migrations/1585595169060_update_permission_user_public_table_cccontracts/down.yaml new file mode 100644 index 000000000..cc00c8e6a --- /dev/null +++ b/hasura/migrations/1585595169060_update_permission_user_public_table_cccontracts/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: cccontracts + schema: public + type: drop_insert_permission diff --git a/hasura/migrations/1585595169060_update_permission_user_public_table_cccontracts/up.yaml b/hasura/migrations/1585595169060_update_permission_user_public_table_cccontracts/up.yaml new file mode 100644 index 000000000..568bf087f --- /dev/null +++ b/hasura/migrations/1585595169060_update_permission_user_public_table_cccontracts/up.yaml @@ -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 diff --git a/hasura/migrations/1585595175602_update_permission_user_public_table_cccontracts/down.yaml b/hasura/migrations/1585595175602_update_permission_user_public_table_cccontracts/down.yaml new file mode 100644 index 000000000..571e819bf --- /dev/null +++ b/hasura/migrations/1585595175602_update_permission_user_public_table_cccontracts/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: cccontracts + schema: public + type: drop_select_permission diff --git a/hasura/migrations/1585595175602_update_permission_user_public_table_cccontracts/up.yaml b/hasura/migrations/1585595175602_update_permission_user_public_table_cccontracts/up.yaml new file mode 100644 index 000000000..ec3e11f0b --- /dev/null +++ b/hasura/migrations/1585595175602_update_permission_user_public_table_cccontracts/up.yaml @@ -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 diff --git a/hasura/migrations/1585595180487_update_permission_user_public_table_cccontracts/down.yaml b/hasura/migrations/1585595180487_update_permission_user_public_table_cccontracts/down.yaml new file mode 100644 index 000000000..e443e59f9 --- /dev/null +++ b/hasura/migrations/1585595180487_update_permission_user_public_table_cccontracts/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: cccontracts + schema: public + type: drop_update_permission diff --git a/hasura/migrations/1585595180487_update_permission_user_public_table_cccontracts/up.yaml b/hasura/migrations/1585595180487_update_permission_user_public_table_cccontracts/up.yaml new file mode 100644 index 000000000..dc43d6bf9 --- /dev/null +++ b/hasura/migrations/1585595180487_update_permission_user_public_table_cccontracts/up.yaml @@ -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 diff --git a/hasura/migrations/1585595189270_update_permission_user_public_table_cccontracts/down.yaml b/hasura/migrations/1585595189270_update_permission_user_public_table_cccontracts/down.yaml new file mode 100644 index 000000000..10d362ec2 --- /dev/null +++ b/hasura/migrations/1585595189270_update_permission_user_public_table_cccontracts/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: cccontracts + schema: public + type: drop_delete_permission diff --git a/hasura/migrations/1585595189270_update_permission_user_public_table_cccontracts/up.yaml b/hasura/migrations/1585595189270_update_permission_user_public_table_cccontracts/up.yaml new file mode 100644 index 000000000..dec77695f --- /dev/null +++ b/hasura/migrations/1585595189270_update_permission_user_public_table_cccontracts/up.yaml @@ -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