Add indexes.

This commit is contained in:
Patrick Fic
2023-10-13 09:26:33 -07:00
parent 94bc2fff43
commit fc89c4429d
4 changed files with 15 additions and 3 deletions

View File

@@ -0,0 +1,3 @@
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- create index joblines_line_no_sort on joblines (jobid, line_no asc);

View File

@@ -0,0 +1 @@
create index joblines_line_no_sort on joblines (jobid, line_no asc);

View File

@@ -140,7 +140,6 @@ export const QUERY_JOB_BY_CLM_NO = gql`
}
`;
export const QUERY_CLOSE_DATE_BY_CLM_NO = gql`
query QUERY_CLOSE_DATE_BY_CLM_NO($clm_no: String!) {
jobs(where: { clm_no: { _eq: $clm_no } }) {
@@ -171,7 +170,7 @@ export const UPDATE_JOB = gql`
group
group_verified
requires_reimport
joblines(order_by: { unq_seq: asc }) {
joblines(order_by: { line_no: asc }) {
id
act_price
db_price

View File

@@ -114,7 +114,16 @@ export async function UpsertEstimate(job) {
variables: {
job: { ...job, bodyshopid: shopId },
},
refetchQueries: ["QUERY_ALL_JOBS_PAGINATED", "QUERY_JOB_BY_PK"],
update(cache, { data }) {
cache.modify({
fields: {
jobs(existingJobs) {
return [data.insert_jobs.returning[0], ...existingJobs];
},
},
});
},
// refetchQueries: ["QUERY_ALL_JOBS_PAGINATED", "QUERY_JOB_BY_PK"],
});
logger.info("Job inserted succesfully.");
}