Further index changes.
This commit is contained in:
34
hasura/migrations/1726871373784_run_sql_migration/down.sql
Normal file
34
hasura/migrations/1726871373784_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- CREATE OR REPLACE FUNCTION public.search_exportlog(search text)
|
||||||
|
-- RETURNS SETOF exportlog
|
||||||
|
-- LANGUAGE plpgsql
|
||||||
|
-- STABLE
|
||||||
|
-- AS $function$ BEGIN IF search = '' THEN RETURN query
|
||||||
|
-- SELECT
|
||||||
|
-- *
|
||||||
|
-- FROM
|
||||||
|
-- exportlog e;
|
||||||
|
-- ELSE RETURN query
|
||||||
|
-- SELECT
|
||||||
|
-- e.*
|
||||||
|
-- FROM
|
||||||
|
-- exportlog e
|
||||||
|
-- LEFT JOIN jobs j on j.id = e.jobid
|
||||||
|
-- LEFT JOIN payments p
|
||||||
|
-- ON p.id = e.paymentid
|
||||||
|
-- LEFT JOIN bills b
|
||||||
|
-- ON e.billid = b.id
|
||||||
|
-- WHERE
|
||||||
|
-- (
|
||||||
|
-- j.ro_number ILIKE '%' || search
|
||||||
|
-- OR b.invoice_number ILIKE '%' || search
|
||||||
|
-- OR p.paymentnum ILIKE '%' || search
|
||||||
|
-- OR e.useremail ILIKE '%' || search
|
||||||
|
-- )
|
||||||
|
-- AND (e.jobid = j.id
|
||||||
|
-- or e.paymentid = p.id
|
||||||
|
-- or e.billid = b.id)
|
||||||
|
-- ;
|
||||||
|
-- END IF;
|
||||||
|
-- END $function$;
|
||||||
32
hasura/migrations/1726871373784_run_sql_migration/up.sql
Normal file
32
hasura/migrations/1726871373784_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
CREATE OR REPLACE FUNCTION public.search_exportlog(search text)
|
||||||
|
RETURNS SETOF exportlog
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
STABLE
|
||||||
|
AS $function$ BEGIN IF search = '' THEN RETURN query
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
exportlog e;
|
||||||
|
ELSE RETURN query
|
||||||
|
SELECT
|
||||||
|
e.*
|
||||||
|
FROM
|
||||||
|
exportlog e
|
||||||
|
LEFT JOIN jobs j on j.id = e.jobid
|
||||||
|
LEFT JOIN payments p
|
||||||
|
ON p.id = e.paymentid
|
||||||
|
LEFT JOIN bills b
|
||||||
|
ON e.billid = b.id
|
||||||
|
WHERE
|
||||||
|
(
|
||||||
|
j.ro_number ILIKE '%' || search
|
||||||
|
OR b.invoice_number ILIKE '%' || search
|
||||||
|
OR p.paymentnum ILIKE '%' || search
|
||||||
|
OR e.useremail ILIKE '%' || search
|
||||||
|
)
|
||||||
|
AND (e.jobid = j.id
|
||||||
|
or e.paymentid = p.id
|
||||||
|
or e.billid = b.id)
|
||||||
|
;
|
||||||
|
END IF;
|
||||||
|
END $function$;
|
||||||
34
hasura/migrations/1726871384601_run_sql_migration/down.sql
Normal file
34
hasura/migrations/1726871384601_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- CREATE OR REPLACE FUNCTION public.search_exportlog(search text)
|
||||||
|
-- RETURNS SETOF exportlog
|
||||||
|
-- LANGUAGE plpgsql
|
||||||
|
-- STABLE
|
||||||
|
-- AS $function$ BEGIN IF search = '' THEN RETURN query
|
||||||
|
-- SELECT
|
||||||
|
-- *
|
||||||
|
-- FROM
|
||||||
|
-- exportlog e;
|
||||||
|
-- ELSE RETURN query
|
||||||
|
-- SELECT
|
||||||
|
-- e.*
|
||||||
|
-- FROM
|
||||||
|
-- exportlog e
|
||||||
|
-- LEFT JOIN jobs j on j.id = e.jobid
|
||||||
|
-- LEFT JOIN payments p
|
||||||
|
-- ON p.id = e.paymentid
|
||||||
|
-- LEFT JOIN bills b
|
||||||
|
-- ON e.billid = b.id
|
||||||
|
-- WHERE
|
||||||
|
-- (
|
||||||
|
-- j.ro_number ILIKE '%' || search
|
||||||
|
-- OR b.invoice_number ILIKE '%' || search
|
||||||
|
-- OR p.paymentnum ILIKE '%' || search
|
||||||
|
-- OR e.useremail ILIKE '%' || search
|
||||||
|
-- )
|
||||||
|
-- AND (e.jobid = j.id
|
||||||
|
-- or e.paymentid = p.id
|
||||||
|
-- or e.billid = b.id)
|
||||||
|
-- ;
|
||||||
|
-- END IF;
|
||||||
|
-- END $function$;
|
||||||
32
hasura/migrations/1726871384601_run_sql_migration/up.sql
Normal file
32
hasura/migrations/1726871384601_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
CREATE OR REPLACE FUNCTION public.search_exportlog(search text)
|
||||||
|
RETURNS SETOF exportlog
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
STABLE
|
||||||
|
AS $function$ BEGIN IF search = '' THEN RETURN query
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
exportlog e;
|
||||||
|
ELSE RETURN query
|
||||||
|
SELECT
|
||||||
|
e.*
|
||||||
|
FROM
|
||||||
|
exportlog e
|
||||||
|
LEFT JOIN jobs j on j.id = e.jobid
|
||||||
|
LEFT JOIN payments p
|
||||||
|
ON p.id = e.paymentid
|
||||||
|
LEFT JOIN bills b
|
||||||
|
ON e.billid = b.id
|
||||||
|
WHERE
|
||||||
|
(
|
||||||
|
j.ro_number ILIKE '%' || search
|
||||||
|
OR b.invoice_number ILIKE '%' || search
|
||||||
|
OR p.paymentnum ILIKE '%' || search
|
||||||
|
OR e.useremail ILIKE '%' || search
|
||||||
|
)
|
||||||
|
AND (e.jobid = j.id
|
||||||
|
or e.paymentid = p.id
|
||||||
|
or e.billid = b.id)
|
||||||
|
;
|
||||||
|
END IF;
|
||||||
|
END $function$;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
DROP INDEX IF EXISTS "public"."idx_bill_invoice_number";
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
CREATE INDEX "idx_bill_invoice_number" on
|
||||||
|
"public"."bills" using btree ("invoice_number");
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
DROP INDEX IF EXISTS "public"."idx_payments_paymentnum";
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
CREATE INDEX "idx_payments_paymentnum" on
|
||||||
|
"public"."payments" using btree ("paymentnum");
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
DROP INDEX IF EXISTS "public"."exportlog_useremail";
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
CREATE INDEX "exportlog_useremail" on
|
||||||
|
"public"."exportlog" using btree ("useremail");
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
DROP INDEX IF EXISTS "public"."available_jobs_jobid";
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
CREATE INDEX "available_jobs_jobid" on
|
||||||
|
"public"."available_jobs" using btree ("jobid");
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- CREATE INDEX idx_jobslines_ordering ON joblines (jobid, removed, line_no asc) where removed=false;
|
||||||
1
hasura/migrations/1726872195945_run_sql_migration/up.sql
Normal file
1
hasura/migrations/1726872195945_run_sql_migration/up.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
CREATE INDEX idx_jobslines_ordering ON joblines (jobid, removed, line_no asc) where removed=false;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- CREATE INDEX idx_joblines_types ON joblines (jobid, mod_lbr_ty, removed) where removed=false;
|
||||||
1
hasura/migrations/1726872572029_run_sql_migration/up.sql
Normal file
1
hasura/migrations/1726872572029_run_sql_migration/up.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
CREATE INDEX idx_joblines_types ON joblines (jobid, mod_lbr_ty, removed) where removed=false;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- CREATE INDEX idx_exportlog_created_at_desc ON exportlog (created_at desc);
|
||||||
1
hasura/migrations/1726872872872_run_sql_migration/up.sql
Normal file
1
hasura/migrations/1726872872872_run_sql_migration/up.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
CREATE INDEX idx_exportlog_created_at_desc ON exportlog (created_at desc);
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
CREATE INDEX "joblines_idx_removed" on
|
||||||
|
"public"."joblines" using btree ("removed");
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
DROP INDEX IF EXISTS "public"."joblines_idx_removed";
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
CREATE INDEX "joblines_idx_line_no" on
|
||||||
|
"public"."joblines" using btree ("jobid", "line_no");
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
DROP INDEX IF EXISTS "public"."joblines_idx_line_no";
|
||||||
Reference in New Issue
Block a user