Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
feat: tables for quotes
Brad Barbinb9cf935e1ea6
diff --git a/packages/database/src/types.ts b/packages/database/src/types.tsindex 5e56fbc23b..f6072b8d45 100644--- a/packages/database/src/types.ts+++ b/packages/database/src/types.ts@@ -12424,14 +12424,16 @@ export type Database = {customerLocationId: string | nullcustomerReference: string | nullcustomFields: Json | null+ estimatorId: string | nullexpirationDate: string | nullid: stringlocationId: string | null- name: string | null- notes: string | null+ notes: Json | nullquoteDate: string | nullquoteId: stringrevisionId: number+ salesPersonId: string | null+ salesRfqId: string | nullstatus: Database["public"]["Enums"]["quoteStatus"]updatedAt: string | nullupdatedBy: string | null@@ -12446,14 +12448,16 @@ export type Database = {customerLocationId?: string | nullcustomerReference?: string | nullcustomFields?: Json | null+ estimatorId?: string | nullexpirationDate?: string | nullid?: stringlocationId?: string | null- name?: string | null- notes?: string | null+ notes?: Json | nullquoteDate?: string | nullquoteId: stringrevisionId?: number+ salesPersonId?: string | null+ salesRfqId?: string | nullstatus?: Database["public"]["Enums"]["quoteStatus"]updatedAt?: string | nullupdatedBy?: string | null@@ -12468,14 +12472,16 @@ export type Database = {customerLocationId?: string | nullcustomerReference?: string | nullcustomFields?: Json | null+ estimatorId?: string | nullexpirationDate?: string | nullid?: stringlocationId?: string | null- name?: string | null- notes?: string | null+ notes?: Json | nullquoteDate?: string | nullquoteId?: stringrevisionId?: number+ salesPersonId?: string | null+ salesRfqId?: string | nullstatus?: Database["public"]["Enums"]["quoteStatus"]updatedAt?: string | nullupdatedBy?: string | null@@ -12615,276 +12621,147 @@ export type Database = {referencedColumns: ["id"]},{- foreignKeyName: "quote_locationId_fkey"- columns: ["locationId"]- isOneToOne: false- referencedRelation: "itemQuantities"- referencedColumns: ["locationId"]- },- {- foreignKeyName: "quote_locationId_fkey"- columns: ["locationId"]- isOneToOne: false- referencedRelation: "location"- referencedColumns: ["id"]- },- {- foreignKeyName: "quote_locationId_fkey"- columns: ["locationId"]- isOneToOne: false- referencedRelation: "purchaseOrders"- referencedColumns: ["locationId"]- },- {- foreignKeyName: "quote_locationId_fkey"- columns: ["locationId"]- isOneToOne: false- referencedRelation: "salesOrders"- referencedColumns: ["locationId"]- },- {- foreignKeyName: "quote_updatedBy_fkey"- columns: ["updatedBy"]+ foreignKeyName: "quote_estimatorId_fkey"+ columns: ["estimatorId"]isOneToOne: falsereferencedRelation: "employees"referencedColumns: ["id"]},{- foreignKeyName: "quote_updatedBy_fkey"- columns: ["updatedBy"]+ foreignKeyName: "quote_estimatorId_fkey"+ columns: ["estimatorId"]isOneToOne: falsereferencedRelation: "employeesAcrossCompanies"referencedColumns: ["id"]},{- foreignKeyName: "quote_updatedBy_fkey"- columns: ["updatedBy"]+ foreignKeyName: "quote_estimatorId_fkey"+ columns: ["estimatorId"]isOneToOne: falsereferencedRelation: "employeeSummary"referencedColumns: ["id"]},{- foreignKeyName: "quote_updatedBy_fkey"- columns: ["updatedBy"]+ foreignKeyName: "quote_estimatorId_fkey"+ columns: ["estimatorId"]isOneToOne: falsereferencedRelation: "user"referencedColumns: ["id"]},{- foreignKeyName: "quote_updatedBy_fkey"- columns: ["updatedBy"]+ foreignKeyName: "quote_estimatorId_fkey"+ columns: ["estimatorId"]isOneToOne: falsereferencedRelation: "userDefaults"referencedColumns: ["userId"]},- ]- }- quoteAssembly: {- Row: {- companyId: string- createdAt: string- createdBy: string- customFields: Json | null- description: string | null- id: string- itemId: string- parentAssemblyId: string | null- quantityPerParent: number- quoteId: string- quoteLineId: string- unitOfMeasureCode: string | null- updatedAt: string | null- updatedBy: string | null- }- Insert: {- companyId: string- createdAt?: string- createdBy: string- customFields?: Json | null- description?: string | null- id?: string- itemId: string- parentAssemblyId?: string | null- quantityPerParent?: number- quoteId: string- quoteLineId: string- unitOfMeasureCode?: string | null- updatedAt?: string | null- updatedBy?: string | null- }- Update: {- companyId?: string- createdAt?: string- createdBy?: string- customFields?: Json | null- description?: string | null- id?: string- itemId?: string- parentAssemblyId?: string | null- quantityPerParent?: number- quoteId?: string- quoteLineId?: string- unitOfMeasureCode?: string | null- updatedAt?: string | null- updatedBy?: string | null- }- Relationships: [{- foreignKeyName: "quoteAssembly_companyId_fkey"- columns: ["companyId"]+ foreignKeyName: "quote_locationId_fkey"+ columns: ["locationId"]isOneToOne: false- referencedRelation: "companies"- referencedColumns: ["id"]+ referencedRelation: "itemQuantities"+ referencedColumns: ["locationId"]},{- foreignKeyName: "quoteAssembly_companyId_fkey"- columns: ["companyId"]+ foreignKeyName: "quote_locationId_fkey"+ columns: ["locationId"]isOneToOne: false- referencedRelation: "company"+ referencedRelation: "location"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_companyId_fkey"- columns: ["companyId"]+ foreignKeyName: "quote_locationId_fkey"+ columns: ["locationId"]isOneToOne: false- referencedRelation: "customFieldTables"- referencedColumns: ["companyId"]+ referencedRelation: "purchaseOrders"+ referencedColumns: ["locationId"]},{- foreignKeyName: "quoteAssembly_companyId_fkey"- columns: ["companyId"]+ foreignKeyName: "quote_locationId_fkey"+ columns: ["locationId"]isOneToOne: false- referencedRelation: "integrations"- referencedColumns: ["companyId"]+ referencedRelation: "salesOrders"+ referencedColumns: ["locationId"]},{- foreignKeyName: "quoteAssembly_createdBy_fkey"- columns: ["createdBy"]+ foreignKeyName: "quote_salesPersonId_fkey"+ columns: ["salesPersonId"]isOneToOne: falsereferencedRelation: "employees"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_createdBy_fkey"- columns: ["createdBy"]+ foreignKeyName: "quote_salesPersonId_fkey"+ columns: ["salesPersonId"]isOneToOne: falsereferencedRelation: "employeesAcrossCompanies"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_createdBy_fkey"- columns: ["createdBy"]+ foreignKeyName: "quote_salesPersonId_fkey"+ columns: ["salesPersonId"]isOneToOne: falsereferencedRelation: "employeeSummary"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_createdBy_fkey"- columns: ["createdBy"]+ foreignKeyName: "quote_salesPersonId_fkey"+ columns: ["salesPersonId"]isOneToOne: falsereferencedRelation: "user"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_createdBy_fkey"- columns: ["createdBy"]+ foreignKeyName: "quote_salesPersonId_fkey"+ columns: ["salesPersonId"]isOneToOne: falsereferencedRelation: "userDefaults"referencedColumns: ["userId"]},{- foreignKeyName: "quoteAssembly_itemId_fkey"- columns: ["itemId"]- isOneToOne: false- referencedRelation: "item"- referencedColumns: ["id"]- },- {- foreignKeyName: "quoteAssembly_itemId_fkey"- columns: ["itemId"]- isOneToOne: false- referencedRelation: "itemQuantities"- referencedColumns: ["itemId"]- },- {- foreignKeyName: "quoteAssembly_parentAssemblyId_fkey"- columns: ["parentAssemblyId"]- isOneToOne: false- referencedRelation: "quoteAssembly"- referencedColumns: ["id"]- },- {- foreignKeyName: "quoteAssembly_quoteId_fkey"- columns: ["quoteId"]- isOneToOne: false- referencedRelation: "quote"- referencedColumns: ["id"]- },- {- foreignKeyName: "quoteAssembly_quoteId_fkey"- columns: ["quoteId"]- isOneToOne: false- referencedRelation: "quoteCustomerDetails"- referencedColumns: ["quoteId"]- },- {- foreignKeyName: "quoteAssembly_quoteId_fkey"- columns: ["quoteId"]- isOneToOne: false- referencedRelation: "quotes"- referencedColumns: ["id"]- },- {- foreignKeyName: "quoteAssembly_quoteLineId_fkey"- columns: ["quoteLineId"]+ foreignKeyName: "quote_salesRfqId_fkey"+ columns: ["salesRfqId"]isOneToOne: false- referencedRelation: "quoteLine"+ referencedRelation: "salesRfq"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_quoteLineId_fkey"- columns: ["quoteLineId"]+ foreignKeyName: "quote_salesRfqId_fkey"+ columns: ["salesRfqId"]isOneToOne: false- referencedRelation: "quoteLines"+ referencedRelation: "salesRfqs"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_unitOfMeasureCode_fkey"- columns: ["unitOfMeasureCode", "companyId"]- isOneToOne: false- referencedRelation: "unitOfMeasure"- referencedColumns: ["code", "companyId"]- },- {- foreignKeyName: "quoteAssembly_updatedBy_fkey"+ foreignKeyName: "quote_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employees"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_updatedBy_fkey"+ foreignKeyName: "quote_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employeesAcrossCompanies"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_updatedBy_fkey"+ foreignKeyName: "quote_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employeeSummary"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_updatedBy_fkey"+ foreignKeyName: "quote_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "user"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_updatedBy_fkey"+ foreignKeyName: "quote_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "userDefaults"@@ -12972,6 +12849,7 @@ export type Database = {customerPartRevision: string | nullcustomFields: Json | nulldescription: string+ estimatorId: string | nullid: stringitemId: stringitemReadableId: string | null@@ -12990,6 +12868,7 @@ export type Database = {customerPartRevision?: string | nullcustomFields?: Json | nulldescription: string+ estimatorId?: string | nullid?: stringitemId: stringitemReadableId?: string | null@@ -13008,6 +12887,7 @@ export type Database = {customerPartRevision?: string | nullcustomFields?: Json | nulldescription?: string+ estimatorId?: string | nullid?: stringitemId?: stringitemReadableId?: string | null@@ -13083,6 +12963,41 @@ export type Database = {referencedRelation: "userDefaults"referencedColumns: ["userId"]},+ {+ foreignKeyName: "quoteLine_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },{foreignKeyName: "quoteLine_itemId_fkey"columns: ["itemId"]@@ -13119,42 +13034,196 @@ export type Database = {referencedColumns: ["id"]},{- foreignKeyName: "quoteLine_unitOfMeasureCode_fkey"- columns: ["unitOfMeasureCode", "companyId"]+ foreignKeyName: "quoteLine_unitOfMeasureCode_fkey"+ columns: ["unitOfMeasureCode", "companyId"]+ isOneToOne: false+ referencedRelation: "unitOfMeasure"+ referencedColumns: ["code", "companyId"]+ },+ {+ foreignKeyName: "quoteLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ ]+ }+ quoteLinePrice: {+ Row: {+ createdAt: string+ createdBy: string+ discountPercent: number+ extendedPrice: number+ id: string+ leadTime: number+ markupPercent: number+ quantity: number+ quoteId: string+ quoteLineId: string+ unitCost: number+ updatedAt: string | null+ updatedBy: string | null+ }+ Insert: {+ createdAt?: string+ createdBy: string+ discountPercent?: number+ extendedPrice?: number+ id?: string+ leadTime?: number+ markupPercent?: number+ quantity?: number+ quoteId: string+ quoteLineId: string+ unitCost?: number+ updatedAt?: string | null+ updatedBy?: string | null+ }+ Update: {+ createdAt?: string+ createdBy?: string+ discountPercent?: number+ extendedPrice?: number+ id?: string+ leadTime?: number+ markupPercent?: number+ quantity?: number+ quoteId?: string+ quoteLineId?: string+ unitCost?: number+ updatedAt?: string | null+ updatedBy?: string | null+ }+ Relationships: [+ {+ foreignKeyName: "quoteLinePrice_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLinePrice_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLinePrice_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLinePrice_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLinePrice_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "quoteLinePrice_quoteId_fkey"+ columns: ["quoteId"]+ isOneToOne: false+ referencedRelation: "quote"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLinePrice_quoteId_fkey"+ columns: ["quoteId"]+ isOneToOne: false+ referencedRelation: "quoteCustomerDetails"+ referencedColumns: ["quoteId"]+ },+ {+ foreignKeyName: "quoteLinePrice_quoteId_fkey"+ columns: ["quoteId"]+ isOneToOne: false+ referencedRelation: "quotes"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLinePrice_quoteLineId_fkey"+ columns: ["quoteLineId"]+ isOneToOne: false+ referencedRelation: "quoteLine"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLinePrice_quoteLineId_fkey"+ columns: ["quoteLineId"]isOneToOne: false- referencedRelation: "unitOfMeasure"- referencedColumns: ["code", "companyId"]+ referencedRelation: "quoteLines"+ referencedColumns: ["id"]},{- foreignKeyName: "quoteLine_updatedBy_fkey"+ foreignKeyName: "quoteLinePrice_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employees"referencedColumns: ["id"]},{- foreignKeyName: "quoteLine_updatedBy_fkey"+ foreignKeyName: "quoteLinePrice_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employeesAcrossCompanies"referencedColumns: ["id"]},{- foreignKeyName: "quoteLine_updatedBy_fkey"+ foreignKeyName: "quoteLinePrice_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employeeSummary"referencedColumns: ["id"]},{- foreignKeyName: "quoteLine_updatedBy_fkey"+ foreignKeyName: "quoteLinePrice_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "user"referencedColumns: ["id"]},{- foreignKeyName: "quoteLine_updatedBy_fkey"+ foreignKeyName: "quoteLinePrice_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "userDefaults"@@ -13162,153 +13231,212 @@ export type Database = {},]}- quoteLinePrice: {+ quoteMakeMethod: {Row: {+ companyId: stringcreatedAt: stringcreatedBy: string- discountPercent: number- extendedPrice: number+ customFields: Json | null+ description: string | nullid: string- leadTime: number- markupPercent: number- quantity: number+ itemId: string+ parentMaterialId: string | null+ quantityPerParent: numberquoteId: stringquoteLineId: string- unitCost: number+ unitOfMeasureCode: string | nullupdatedAt: string | nullupdatedBy: string | null}Insert: {+ companyId: stringcreatedAt?: stringcreatedBy: string- discountPercent?: number- extendedPrice?: number+ customFields?: Json | null+ description?: string | nullid?: string- leadTime?: number- markupPercent?: number- quantity?: number+ itemId: string+ parentMaterialId?: string | null+ quantityPerParent?: numberquoteId: stringquoteLineId: string- unitCost?: number+ unitOfMeasureCode?: string | nullupdatedAt?: string | nullupdatedBy?: string | null}Update: {+ companyId?: stringcreatedAt?: stringcreatedBy?: string- discountPercent?: number- extendedPrice?: number+ customFields?: Json | null+ description?: string | nullid?: string- leadTime?: number- markupPercent?: number- quantity?: number+ itemId?: string+ parentMaterialId?: string | null+ quantityPerParent?: numberquoteId?: stringquoteLineId?: string- unitCost?: number+ unitOfMeasureCode?: string | nullupdatedAt?: string | nullupdatedBy?: string | null}Relationships: [{- foreignKeyName: "quoteLinePrice_createdBy_fkey"+ foreignKeyName: "quoteMakeMethod_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "companies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteMakeMethod_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteMakeMethod_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "customFieldTables"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "quoteMakeMethod_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "integrations"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "quoteMakeMethod_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employees"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_createdBy_fkey"+ foreignKeyName: "quoteMakeMethod_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employeesAcrossCompanies"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_createdBy_fkey"+ foreignKeyName: "quoteMakeMethod_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employeeSummary"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_createdBy_fkey"+ foreignKeyName: "quoteMakeMethod_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "user"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_createdBy_fkey"+ foreignKeyName: "quoteMakeMethod_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "userDefaults"referencedColumns: ["userId"]},{- foreignKeyName: "quoteLinePrice_quoteId_fkey"+ foreignKeyName: "quoteMakeMethod_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "item"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteMakeMethod_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "itemQuantities"+ referencedColumns: ["itemId"]+ },+ {+ foreignKeyName: "quoteMakeMethod_parentMaterialId_fkey"+ columns: ["parentMaterialId"]+ isOneToOne: false+ referencedRelation: "quoteMaterial"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteMakeMethod_quoteId_fkey"columns: ["quoteId"]isOneToOne: falsereferencedRelation: "quote"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_quoteId_fkey"+ foreignKeyName: "quoteMakeMethod_quoteId_fkey"columns: ["quoteId"]isOneToOne: falsereferencedRelation: "quoteCustomerDetails"referencedColumns: ["quoteId"]},{- foreignKeyName: "quoteLinePrice_quoteId_fkey"+ foreignKeyName: "quoteMakeMethod_quoteId_fkey"columns: ["quoteId"]isOneToOne: falsereferencedRelation: "quotes"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_quoteLineId_fkey"+ foreignKeyName: "quoteMakeMethod_quoteLineId_fkey"columns: ["quoteLineId"]isOneToOne: falsereferencedRelation: "quoteLine"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_quoteLineId_fkey"+ foreignKeyName: "quoteMakeMethod_quoteLineId_fkey"columns: ["quoteLineId"]isOneToOne: falsereferencedRelation: "quoteLines"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_updatedBy_fkey"+ foreignKeyName: "quoteMakeMethod_unitOfMeasureCode_fkey"+ columns: ["unitOfMeasureCode", "companyId"]+ isOneToOne: false+ referencedRelation: "unitOfMeasure"+ referencedColumns: ["code", "companyId"]+ },+ {+ foreignKeyName: "quoteMakeMethod_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employees"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_updatedBy_fkey"+ foreignKeyName: "quoteMakeMethod_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employeesAcrossCompanies"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_updatedBy_fkey"+ foreignKeyName: "quoteMakeMethod_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employeeSummary"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_updatedBy_fkey"+ foreignKeyName: "quoteMakeMethod_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "user"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_updatedBy_fkey"+ foreignKeyName: "quoteMakeMethod_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "userDefaults"@@ -13328,7 +13456,8 @@ export type Database = {quantity: numberquoteId: stringquoteLineId: string- quoteOperationId: string+ quoteMakeMethodId: string | null+ quoteOperationId: string | nullunitCost: numberunitOfMeasureCode: string | nullupdatedAt: string | null@@ -13345,7 +13474,8 @@ export type Database = {quantity?: numberquoteId: stringquoteLineId: string- quoteOperationId: string+ quoteMakeMethodId?: string | null+ quoteOperationId?: string | nullunitCost?: numberunitOfMeasureCode?: string | nullupdatedAt?: string | null@@ -13362,7 +13492,8 @@ export type Database = {quantity?: numberquoteId?: stringquoteLineId?: string- quoteOperationId?: string+ quoteMakeMethodId?: string | null+ quoteOperationId?: string | nullunitCost?: numberunitOfMeasureCode?: string | nullupdatedAt?: string | null@@ -13481,6 +13612,13 @@ export type Database = {referencedRelation: "quoteLines"referencedColumns: ["id"]},+ {+ foreignKeyName: "quoteMaterial_quoteMakeMethodId_fkey"+ columns: ["quoteMakeMethodId"]+ isOneToOne: false+ referencedRelation: "quoteMakeMethod"+ referencedColumns: ["id"]+ },{foreignKeyName: "quoteMaterial_quoteOperationId_fkey"columns: ["quoteOperationId"]@@ -13544,9 +13682,9 @@ export type Database = {laborRate: numberoverheadRate: numberproductionStandard: number- quoteAssemblyId: string | nullquoteId: stringquoteLineId: string+ quoteMakeMethodId: string | nullquotingRate: numbersetupHours: numberstandardFactor: Database["public"]["Enums"]["factor"]@@ -13565,9 +13703,9 @@ export type Database = {laborRate?: numberoverheadRate?: numberproductionStandard?: number- quoteAssemblyId?: string | nullquoteId: stringquoteLineId: string+ quoteMakeMethodId?: string | nullquotingRate?: numbersetupHours?: numberstandardFactor?: Database["public"]["Enums"]["factor"]@@ -13586,9 +13724,9 @@ export type Database = {laborRate?: numberoverheadRate?: numberproductionStandard?: number- quoteAssemblyId?: string | nullquoteId?: stringquoteLineId?: string+ quoteMakeMethodId?: string | nullquotingRate?: numbersetupHours?: numberstandardFactor?: Database["public"]["Enums"]["factor"]@@ -13667,13 +13805,6 @@ export type Database = {referencedRelation: "equipmentType"referencedColumns: ["id"]},- {- foreignKeyName: "quoteOperation_quoteAssemblyId_fkey"- columns: ["quoteAssemblyId"]- isOneToOne: false- referencedRelation: "quoteAssembly"- referencedColumns: ["id"]- },{foreignKeyName: "quoteOperation_quoteId_fkey"columns: ["quoteId"]@@ -13709,6 +13840,13 @@ export type Database = {referencedRelation: "quoteLines"referencedColumns: ["id"]},+ {+ foreignKeyName: "quoteOperation_quoteMakeMethodId_fkey"+ columns: ["quoteMakeMethodId"]+ isOneToOne: false+ referencedRelation: "quoteMakeMethod"+ referencedColumns: ["id"]+ },{foreignKeyName: "quoteOperation_updatedBy_fkey"columns: ["updatedBy"]@@ -14245,7 +14383,6 @@ export type Database = {id: stringnotes: string | nullorderDate: string- quoteId: string | nullrevisionId: numbersalesOrderId: stringstatus: Database["public"]["Enums"]["salesOrderStatus"]@@ -14268,7 +14405,6 @@ export type Database = {id?: stringnotes?: string | nullorderDate?: string- quoteId?: string | nullrevisionId?: numbersalesOrderId: stringstatus?: Database["public"]["Enums"]["salesOrderStatus"]@@ -14291,7 +14427,6 @@ export type Database = {id?: stringnotes?: string | nullorderDate?: string- quoteId?: string | nullrevisionId?: numbersalesOrderId?: stringstatus?: Database["public"]["Enums"]["salesOrderStatus"]@@ -14474,27 +14609,6 @@ export type Database = {referencedRelation: "customerLocation"referencedColumns: ["id"]},- {- foreignKeyName: "salesOrder_quoteId_fkey"- columns: ["quoteId"]- isOneToOne: false- referencedRelation: "quote"- referencedColumns: ["id"]- },- {- foreignKeyName: "salesOrder_quoteId_fkey"- columns: ["quoteId"]- isOneToOne: false- referencedRelation: "quoteCustomerDetails"- referencedColumns: ["quoteId"]- },- {- foreignKeyName: "salesOrder_quoteId_fkey"- columns: ["quoteId"]- isOneToOne: false- referencedRelation: "quotes"- referencedColumns: ["id"]- },{foreignKeyName: "salesOrder_updatedBy_fkey"columns: ["updatedBy"]@@ -22769,6 +22883,7 @@ export type Database = {customerPartRevision: string | nullcustomFields: Json | nulldescription: string | null+ estimatorId: string | nullid: string | nullitemId: string | nullitemReadableId: string | null@@ -22850,6 +22965,41 @@ export type Database = {referencedRelation: "userDefaults"referencedColumns: ["userId"]},+ {+ foreignKeyName: "quoteLine_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },{foreignKeyName: "quoteLine_itemId_fkey"columns: ["itemId"]@@ -22940,17 +23090,19 @@ export type Database = {customerLocationId: string | nullcustomerReference: string | nullcustomFields: Json | null+ estimatorId: string | nullexpirationDate: string | nullfavorite: boolean | nullid: string | nullitemIds: string[] | nulllocationId: string | nulllocationName: string | null- name: string | null- notes: string | null+ notes: Json | nullquoteDate: string | nullquoteId: string | nullrevisionId: number | null+ salesPersonId: string | null+ salesRfqId: string | nullstatus: Database["public"]["Enums"]["quoteStatus"] | nullupdatedAt: string | nullupdatedBy: string | null@@ -23089,6 +23241,41 @@ export type Database = {referencedRelation: "customerLocation"referencedColumns: ["id"]},+ {+ foreignKeyName: "quote_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quote_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quote_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quote_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quote_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },{foreignKeyName: "quote_locationId_fkey"columns: ["locationId"]@@ -23117,6 +23304,55 @@ export type Database = {referencedRelation: "salesOrders"referencedColumns: ["locationId"]},+ {+ foreignKeyName: "quote_salesPersonId_fkey"+ columns: ["salesPersonId"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quote_salesPersonId_fkey"+ columns: ["salesPersonId"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quote_salesPersonId_fkey"+ columns: ["salesPersonId"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quote_salesPersonId_fkey"+ columns: ["salesPersonId"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quote_salesPersonId_fkey"+ columns: ["salesPersonId"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "quote_salesRfqId_fkey"+ columns: ["salesRfqId"]+ isOneToOne: false+ referencedRelation: "salesRfq"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quote_salesRfqId_fkey"+ columns: ["salesRfqId"]+ isOneToOne: false+ referencedRelation: "salesRfqs"+ referencedColumns: ["id"]+ },{foreignKeyName: "quote_updatedBy_fkey"columns: ["updatedBy"]@@ -23626,7 +23862,6 @@ export type Database = {notes: string | nullorderDate: string | nullpaymentTermName: string | null- quoteId: string | nullreceiptPromisedDate: string | nullreceiptRequestedDate: string | nullrevisionId: number | null@@ -23815,27 +24050,6 @@ export type Database = {referencedRelation: "customerLocation"referencedColumns: ["id"]},- {- foreignKeyName: "salesOrder_quoteId_fkey"- columns: ["quoteId"]- isOneToOne: false- referencedRelation: "quote"- referencedColumns: ["id"]- },- {- foreignKeyName: "salesOrder_quoteId_fkey"- columns: ["quoteId"]- isOneToOne: false- referencedRelation: "quoteCustomerDetails"- referencedColumns: ["quoteId"]- },- {- foreignKeyName: "salesOrder_quoteId_fkey"- columns: ["quoteId"]- isOneToOne: false- referencedRelation: "quotes"- referencedColumns: ["id"]- },{foreignKeyName: "salesOrder_updatedBy_fkey"columns: ["updatedBy"]diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.tsindex 5e56fbc23b..f6072b8d45 100644--- a/packages/database/supabase/functions/lib/types.ts+++ b/packages/database/supabase/functions/lib/types.ts@@ -12424,14 +12424,16 @@ export type Database = {customerLocationId: string | nullcustomerReference: string | nullcustomFields: Json | null+ estimatorId: string | nullexpirationDate: string | nullid: stringlocationId: string | null- name: string | null- notes: string | null+ notes: Json | nullquoteDate: string | nullquoteId: stringrevisionId: number+ salesPersonId: string | null+ salesRfqId: string | nullstatus: Database["public"]["Enums"]["quoteStatus"]updatedAt: string | nullupdatedBy: string | null@@ -12446,14 +12448,16 @@ export type Database = {customerLocationId?: string | nullcustomerReference?: string | nullcustomFields?: Json | null+ estimatorId?: string | nullexpirationDate?: string | nullid?: stringlocationId?: string | null- name?: string | null- notes?: string | null+ notes?: Json | nullquoteDate?: string | nullquoteId: stringrevisionId?: number+ salesPersonId?: string | null+ salesRfqId?: string | nullstatus?: Database["public"]["Enums"]["quoteStatus"]updatedAt?: string | nullupdatedBy?: string | null@@ -12468,14 +12472,16 @@ export type Database = {customerLocationId?: string | nullcustomerReference?: string | nullcustomFields?: Json | null+ estimatorId?: string | nullexpirationDate?: string | nullid?: stringlocationId?: string | null- name?: string | null- notes?: string | null+ notes?: Json | nullquoteDate?: string | nullquoteId?: stringrevisionId?: number+ salesPersonId?: string | null+ salesRfqId?: string | nullstatus?: Database["public"]["Enums"]["quoteStatus"]updatedAt?: string | nullupdatedBy?: string | null@@ -12615,276 +12621,147 @@ export type Database = {referencedColumns: ["id"]},{- foreignKeyName: "quote_locationId_fkey"- columns: ["locationId"]- isOneToOne: false- referencedRelation: "itemQuantities"- referencedColumns: ["locationId"]- },- {- foreignKeyName: "quote_locationId_fkey"- columns: ["locationId"]- isOneToOne: false- referencedRelation: "location"- referencedColumns: ["id"]- },- {- foreignKeyName: "quote_locationId_fkey"- columns: ["locationId"]- isOneToOne: false- referencedRelation: "purchaseOrders"- referencedColumns: ["locationId"]- },- {- foreignKeyName: "quote_locationId_fkey"- columns: ["locationId"]- isOneToOne: false- referencedRelation: "salesOrders"- referencedColumns: ["locationId"]- },- {- foreignKeyName: "quote_updatedBy_fkey"- columns: ["updatedBy"]+ foreignKeyName: "quote_estimatorId_fkey"+ columns: ["estimatorId"]isOneToOne: falsereferencedRelation: "employees"referencedColumns: ["id"]},{- foreignKeyName: "quote_updatedBy_fkey"- columns: ["updatedBy"]+ foreignKeyName: "quote_estimatorId_fkey"+ columns: ["estimatorId"]isOneToOne: falsereferencedRelation: "employeesAcrossCompanies"referencedColumns: ["id"]},{- foreignKeyName: "quote_updatedBy_fkey"- columns: ["updatedBy"]+ foreignKeyName: "quote_estimatorId_fkey"+ columns: ["estimatorId"]isOneToOne: falsereferencedRelation: "employeeSummary"referencedColumns: ["id"]},{- foreignKeyName: "quote_updatedBy_fkey"- columns: ["updatedBy"]+ foreignKeyName: "quote_estimatorId_fkey"+ columns: ["estimatorId"]isOneToOne: falsereferencedRelation: "user"referencedColumns: ["id"]},{- foreignKeyName: "quote_updatedBy_fkey"- columns: ["updatedBy"]+ foreignKeyName: "quote_estimatorId_fkey"+ columns: ["estimatorId"]isOneToOne: falsereferencedRelation: "userDefaults"referencedColumns: ["userId"]},- ]- }- quoteAssembly: {- Row: {- companyId: string- createdAt: string- createdBy: string- customFields: Json | null- description: string | null- id: string- itemId: string- parentAssemblyId: string | null- quantityPerParent: number- quoteId: string- quoteLineId: string- unitOfMeasureCode: string | null- updatedAt: string | null- updatedBy: string | null- }- Insert: {- companyId: string- createdAt?: string- createdBy: string- customFields?: Json | null- description?: string | null- id?: string- itemId: string- parentAssemblyId?: string | null- quantityPerParent?: number- quoteId: string- quoteLineId: string- unitOfMeasureCode?: string | null- updatedAt?: string | null- updatedBy?: string | null- }- Update: {- companyId?: string- createdAt?: string- createdBy?: string- customFields?: Json | null- description?: string | null- id?: string- itemId?: string- parentAssemblyId?: string | null- quantityPerParent?: number- quoteId?: string- quoteLineId?: string- unitOfMeasureCode?: string | null- updatedAt?: string | null- updatedBy?: string | null- }- Relationships: [{- foreignKeyName: "quoteAssembly_companyId_fkey"- columns: ["companyId"]+ foreignKeyName: "quote_locationId_fkey"+ columns: ["locationId"]isOneToOne: false- referencedRelation: "companies"- referencedColumns: ["id"]+ referencedRelation: "itemQuantities"+ referencedColumns: ["locationId"]},{- foreignKeyName: "quoteAssembly_companyId_fkey"- columns: ["companyId"]+ foreignKeyName: "quote_locationId_fkey"+ columns: ["locationId"]isOneToOne: false- referencedRelation: "company"+ referencedRelation: "location"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_companyId_fkey"- columns: ["companyId"]+ foreignKeyName: "quote_locationId_fkey"+ columns: ["locationId"]isOneToOne: false- referencedRelation: "customFieldTables"- referencedColumns: ["companyId"]+ referencedRelation: "purchaseOrders"+ referencedColumns: ["locationId"]},{- foreignKeyName: "quoteAssembly_companyId_fkey"- columns: ["companyId"]+ foreignKeyName: "quote_locationId_fkey"+ columns: ["locationId"]isOneToOne: false- referencedRelation: "integrations"- referencedColumns: ["companyId"]+ referencedRelation: "salesOrders"+ referencedColumns: ["locationId"]},{- foreignKeyName: "quoteAssembly_createdBy_fkey"- columns: ["createdBy"]+ foreignKeyName: "quote_salesPersonId_fkey"+ columns: ["salesPersonId"]isOneToOne: falsereferencedRelation: "employees"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_createdBy_fkey"- columns: ["createdBy"]+ foreignKeyName: "quote_salesPersonId_fkey"+ columns: ["salesPersonId"]isOneToOne: falsereferencedRelation: "employeesAcrossCompanies"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_createdBy_fkey"- columns: ["createdBy"]+ foreignKeyName: "quote_salesPersonId_fkey"+ columns: ["salesPersonId"]isOneToOne: falsereferencedRelation: "employeeSummary"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_createdBy_fkey"- columns: ["createdBy"]+ foreignKeyName: "quote_salesPersonId_fkey"+ columns: ["salesPersonId"]isOneToOne: falsereferencedRelation: "user"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_createdBy_fkey"- columns: ["createdBy"]+ foreignKeyName: "quote_salesPersonId_fkey"+ columns: ["salesPersonId"]isOneToOne: falsereferencedRelation: "userDefaults"referencedColumns: ["userId"]},{- foreignKeyName: "quoteAssembly_itemId_fkey"- columns: ["itemId"]- isOneToOne: false- referencedRelation: "item"- referencedColumns: ["id"]- },- {- foreignKeyName: "quoteAssembly_itemId_fkey"- columns: ["itemId"]- isOneToOne: false- referencedRelation: "itemQuantities"- referencedColumns: ["itemId"]- },- {- foreignKeyName: "quoteAssembly_parentAssemblyId_fkey"- columns: ["parentAssemblyId"]- isOneToOne: false- referencedRelation: "quoteAssembly"- referencedColumns: ["id"]- },- {- foreignKeyName: "quoteAssembly_quoteId_fkey"- columns: ["quoteId"]- isOneToOne: false- referencedRelation: "quote"- referencedColumns: ["id"]- },- {- foreignKeyName: "quoteAssembly_quoteId_fkey"- columns: ["quoteId"]- isOneToOne: false- referencedRelation: "quoteCustomerDetails"- referencedColumns: ["quoteId"]- },- {- foreignKeyName: "quoteAssembly_quoteId_fkey"- columns: ["quoteId"]- isOneToOne: false- referencedRelation: "quotes"- referencedColumns: ["id"]- },- {- foreignKeyName: "quoteAssembly_quoteLineId_fkey"- columns: ["quoteLineId"]+ foreignKeyName: "quote_salesRfqId_fkey"+ columns: ["salesRfqId"]isOneToOne: false- referencedRelation: "quoteLine"+ referencedRelation: "salesRfq"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_quoteLineId_fkey"- columns: ["quoteLineId"]+ foreignKeyName: "quote_salesRfqId_fkey"+ columns: ["salesRfqId"]isOneToOne: false- referencedRelation: "quoteLines"+ referencedRelation: "salesRfqs"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_unitOfMeasureCode_fkey"- columns: ["unitOfMeasureCode", "companyId"]- isOneToOne: false- referencedRelation: "unitOfMeasure"- referencedColumns: ["code", "companyId"]- },- {- foreignKeyName: "quoteAssembly_updatedBy_fkey"+ foreignKeyName: "quote_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employees"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_updatedBy_fkey"+ foreignKeyName: "quote_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employeesAcrossCompanies"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_updatedBy_fkey"+ foreignKeyName: "quote_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employeeSummary"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_updatedBy_fkey"+ foreignKeyName: "quote_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "user"referencedColumns: ["id"]},{- foreignKeyName: "quoteAssembly_updatedBy_fkey"+ foreignKeyName: "quote_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "userDefaults"@@ -12972,6 +12849,7 @@ export type Database = {customerPartRevision: string | nullcustomFields: Json | nulldescription: string+ estimatorId: string | nullid: stringitemId: stringitemReadableId: string | null@@ -12990,6 +12868,7 @@ export type Database = {customerPartRevision?: string | nullcustomFields?: Json | nulldescription: string+ estimatorId?: string | nullid?: stringitemId: stringitemReadableId?: string | null@@ -13008,6 +12887,7 @@ export type Database = {customerPartRevision?: string | nullcustomFields?: Json | nulldescription?: string+ estimatorId?: string | nullid?: stringitemId?: stringitemReadableId?: string | null@@ -13083,6 +12963,41 @@ export type Database = {referencedRelation: "userDefaults"referencedColumns: ["userId"]},+ {+ foreignKeyName: "quoteLine_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },{foreignKeyName: "quoteLine_itemId_fkey"columns: ["itemId"]@@ -13119,42 +13034,196 @@ export type Database = {referencedColumns: ["id"]},{- foreignKeyName: "quoteLine_unitOfMeasureCode_fkey"- columns: ["unitOfMeasureCode", "companyId"]+ foreignKeyName: "quoteLine_unitOfMeasureCode_fkey"+ columns: ["unitOfMeasureCode", "companyId"]+ isOneToOne: false+ referencedRelation: "unitOfMeasure"+ referencedColumns: ["code", "companyId"]+ },+ {+ foreignKeyName: "quoteLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ ]+ }+ quoteLinePrice: {+ Row: {+ createdAt: string+ createdBy: string+ discountPercent: number+ extendedPrice: number+ id: string+ leadTime: number+ markupPercent: number+ quantity: number+ quoteId: string+ quoteLineId: string+ unitCost: number+ updatedAt: string | null+ updatedBy: string | null+ }+ Insert: {+ createdAt?: string+ createdBy: string+ discountPercent?: number+ extendedPrice?: number+ id?: string+ leadTime?: number+ markupPercent?: number+ quantity?: number+ quoteId: string+ quoteLineId: string+ unitCost?: number+ updatedAt?: string | null+ updatedBy?: string | null+ }+ Update: {+ createdAt?: string+ createdBy?: string+ discountPercent?: number+ extendedPrice?: number+ id?: string+ leadTime?: number+ markupPercent?: number+ quantity?: number+ quoteId?: string+ quoteLineId?: string+ unitCost?: number+ updatedAt?: string | null+ updatedBy?: string | null+ }+ Relationships: [+ {+ foreignKeyName: "quoteLinePrice_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLinePrice_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLinePrice_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLinePrice_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLinePrice_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "quoteLinePrice_quoteId_fkey"+ columns: ["quoteId"]+ isOneToOne: false+ referencedRelation: "quote"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLinePrice_quoteId_fkey"+ columns: ["quoteId"]+ isOneToOne: false+ referencedRelation: "quoteCustomerDetails"+ referencedColumns: ["quoteId"]+ },+ {+ foreignKeyName: "quoteLinePrice_quoteId_fkey"+ columns: ["quoteId"]+ isOneToOne: false+ referencedRelation: "quotes"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLinePrice_quoteLineId_fkey"+ columns: ["quoteLineId"]+ isOneToOne: false+ referencedRelation: "quoteLine"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLinePrice_quoteLineId_fkey"+ columns: ["quoteLineId"]isOneToOne: false- referencedRelation: "unitOfMeasure"- referencedColumns: ["code", "companyId"]+ referencedRelation: "quoteLines"+ referencedColumns: ["id"]},{- foreignKeyName: "quoteLine_updatedBy_fkey"+ foreignKeyName: "quoteLinePrice_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employees"referencedColumns: ["id"]},{- foreignKeyName: "quoteLine_updatedBy_fkey"+ foreignKeyName: "quoteLinePrice_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employeesAcrossCompanies"referencedColumns: ["id"]},{- foreignKeyName: "quoteLine_updatedBy_fkey"+ foreignKeyName: "quoteLinePrice_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employeeSummary"referencedColumns: ["id"]},{- foreignKeyName: "quoteLine_updatedBy_fkey"+ foreignKeyName: "quoteLinePrice_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "user"referencedColumns: ["id"]},{- foreignKeyName: "quoteLine_updatedBy_fkey"+ foreignKeyName: "quoteLinePrice_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "userDefaults"@@ -13162,153 +13231,212 @@ export type Database = {},]}- quoteLinePrice: {+ quoteMakeMethod: {Row: {+ companyId: stringcreatedAt: stringcreatedBy: string- discountPercent: number- extendedPrice: number+ customFields: Json | null+ description: string | nullid: string- leadTime: number- markupPercent: number- quantity: number+ itemId: string+ parentMaterialId: string | null+ quantityPerParent: numberquoteId: stringquoteLineId: string- unitCost: number+ unitOfMeasureCode: string | nullupdatedAt: string | nullupdatedBy: string | null}Insert: {+ companyId: stringcreatedAt?: stringcreatedBy: string- discountPercent?: number- extendedPrice?: number+ customFields?: Json | null+ description?: string | nullid?: string- leadTime?: number- markupPercent?: number- quantity?: number+ itemId: string+ parentMaterialId?: string | null+ quantityPerParent?: numberquoteId: stringquoteLineId: string- unitCost?: number+ unitOfMeasureCode?: string | nullupdatedAt?: string | nullupdatedBy?: string | null}Update: {+ companyId?: stringcreatedAt?: stringcreatedBy?: string- discountPercent?: number- extendedPrice?: number+ customFields?: Json | null+ description?: string | nullid?: string- leadTime?: number- markupPercent?: number- quantity?: number+ itemId?: string+ parentMaterialId?: string | null+ quantityPerParent?: numberquoteId?: stringquoteLineId?: string- unitCost?: number+ unitOfMeasureCode?: string | nullupdatedAt?: string | nullupdatedBy?: string | null}Relationships: [{- foreignKeyName: "quoteLinePrice_createdBy_fkey"+ foreignKeyName: "quoteMakeMethod_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "companies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteMakeMethod_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteMakeMethod_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "customFieldTables"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "quoteMakeMethod_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "integrations"+ referencedColumns: ["companyId"]+ },+ {+ foreignKeyName: "quoteMakeMethod_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employees"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_createdBy_fkey"+ foreignKeyName: "quoteMakeMethod_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employeesAcrossCompanies"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_createdBy_fkey"+ foreignKeyName: "quoteMakeMethod_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "employeeSummary"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_createdBy_fkey"+ foreignKeyName: "quoteMakeMethod_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "user"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_createdBy_fkey"+ foreignKeyName: "quoteMakeMethod_createdBy_fkey"columns: ["createdBy"]isOneToOne: falsereferencedRelation: "userDefaults"referencedColumns: ["userId"]},{- foreignKeyName: "quoteLinePrice_quoteId_fkey"+ foreignKeyName: "quoteMakeMethod_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "item"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteMakeMethod_itemId_fkey"+ columns: ["itemId"]+ isOneToOne: false+ referencedRelation: "itemQuantities"+ referencedColumns: ["itemId"]+ },+ {+ foreignKeyName: "quoteMakeMethod_parentMaterialId_fkey"+ columns: ["parentMaterialId"]+ isOneToOne: false+ referencedRelation: "quoteMaterial"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteMakeMethod_quoteId_fkey"columns: ["quoteId"]isOneToOne: falsereferencedRelation: "quote"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_quoteId_fkey"+ foreignKeyName: "quoteMakeMethod_quoteId_fkey"columns: ["quoteId"]isOneToOne: falsereferencedRelation: "quoteCustomerDetails"referencedColumns: ["quoteId"]},{- foreignKeyName: "quoteLinePrice_quoteId_fkey"+ foreignKeyName: "quoteMakeMethod_quoteId_fkey"columns: ["quoteId"]isOneToOne: falsereferencedRelation: "quotes"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_quoteLineId_fkey"+ foreignKeyName: "quoteMakeMethod_quoteLineId_fkey"columns: ["quoteLineId"]isOneToOne: falsereferencedRelation: "quoteLine"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_quoteLineId_fkey"+ foreignKeyName: "quoteMakeMethod_quoteLineId_fkey"columns: ["quoteLineId"]isOneToOne: falsereferencedRelation: "quoteLines"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_updatedBy_fkey"+ foreignKeyName: "quoteMakeMethod_unitOfMeasureCode_fkey"+ columns: ["unitOfMeasureCode", "companyId"]+ isOneToOne: false+ referencedRelation: "unitOfMeasure"+ referencedColumns: ["code", "companyId"]+ },+ {+ foreignKeyName: "quoteMakeMethod_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employees"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_updatedBy_fkey"+ foreignKeyName: "quoteMakeMethod_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employeesAcrossCompanies"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_updatedBy_fkey"+ foreignKeyName: "quoteMakeMethod_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "employeeSummary"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_updatedBy_fkey"+ foreignKeyName: "quoteMakeMethod_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "user"referencedColumns: ["id"]},{- foreignKeyName: "quoteLinePrice_updatedBy_fkey"+ foreignKeyName: "quoteMakeMethod_updatedBy_fkey"columns: ["updatedBy"]isOneToOne: falsereferencedRelation: "userDefaults"@@ -13328,7 +13456,8 @@ export type Database = {quantity: numberquoteId: stringquoteLineId: string- quoteOperationId: string+ quoteMakeMethodId: string | null+ quoteOperationId: string | nullunitCost: numberunitOfMeasureCode: string | nullupdatedAt: string | null@@ -13345,7 +13474,8 @@ export type Database = {quantity?: numberquoteId: stringquoteLineId: string- quoteOperationId: string+ quoteMakeMethodId?: string | null+ quoteOperationId?: string | nullunitCost?: numberunitOfMeasureCode?: string | nullupdatedAt?: string | null@@ -13362,7 +13492,8 @@ export type Database = {quantity?: numberquoteId?: stringquoteLineId?: string- quoteOperationId?: string+ quoteMakeMethodId?: string | null+ quoteOperationId?: string | nullunitCost?: numberunitOfMeasureCode?: string | nullupdatedAt?: string | null@@ -13481,6 +13612,13 @@ export type Database = {referencedRelation: "quoteLines"referencedColumns: ["id"]},+ {+ foreignKeyName: "quoteMaterial_quoteMakeMethodId_fkey"+ columns: ["quoteMakeMethodId"]+ isOneToOne: false+ referencedRelation: "quoteMakeMethod"+ referencedColumns: ["id"]+ },{foreignKeyName: "quoteMaterial_quoteOperationId_fkey"columns: ["quoteOperationId"]@@ -13544,9 +13682,9 @@ export type Database = {laborRate: numberoverheadRate: numberproductionStandard: number- quoteAssemblyId: string | nullquoteId: stringquoteLineId: string+ quoteMakeMethodId: string | nullquotingRate: numbersetupHours: numberstandardFactor: Database["public"]["Enums"]["factor"]@@ -13565,9 +13703,9 @@ export type Database = {laborRate?: numberoverheadRate?: numberproductionStandard?: number- quoteAssemblyId?: string | nullquoteId: stringquoteLineId: string+ quoteMakeMethodId?: string | nullquotingRate?: numbersetupHours?: numberstandardFactor?: Database["public"]["Enums"]["factor"]@@ -13586,9 +13724,9 @@ export type Database = {laborRate?: numberoverheadRate?: numberproductionStandard?: number- quoteAssemblyId?: string | nullquoteId?: stringquoteLineId?: string+ quoteMakeMethodId?: string | nullquotingRate?: numbersetupHours?: numberstandardFactor?: Database["public"]["Enums"]["factor"]@@ -13667,13 +13805,6 @@ export type Database = {referencedRelation: "equipmentType"referencedColumns: ["id"]},- {- foreignKeyName: "quoteOperation_quoteAssemblyId_fkey"- columns: ["quoteAssemblyId"]- isOneToOne: false- referencedRelation: "quoteAssembly"- referencedColumns: ["id"]- },{foreignKeyName: "quoteOperation_quoteId_fkey"columns: ["quoteId"]@@ -13709,6 +13840,13 @@ export type Database = {referencedRelation: "quoteLines"referencedColumns: ["id"]},+ {+ foreignKeyName: "quoteOperation_quoteMakeMethodId_fkey"+ columns: ["quoteMakeMethodId"]+ isOneToOne: false+ referencedRelation: "quoteMakeMethod"+ referencedColumns: ["id"]+ },{foreignKeyName: "quoteOperation_updatedBy_fkey"columns: ["updatedBy"]@@ -14245,7 +14383,6 @@ export type Database = {id: stringnotes: string | nullorderDate: string- quoteId: string | nullrevisionId: numbersalesOrderId: stringstatus: Database["public"]["Enums"]["salesOrderStatus"]@@ -14268,7 +14405,6 @@ export type Database = {id?: stringnotes?: string | nullorderDate?: string- quoteId?: string | nullrevisionId?: numbersalesOrderId: stringstatus?: Database["public"]["Enums"]["salesOrderStatus"]@@ -14291,7 +14427,6 @@ export type Database = {id?: stringnotes?: string | nullorderDate?: string- quoteId?: string | nullrevisionId?: numbersalesOrderId?: stringstatus?: Database["public"]["Enums"]["salesOrderStatus"]@@ -14474,27 +14609,6 @@ export type Database = {referencedRelation: "customerLocation"referencedColumns: ["id"]},- {- foreignKeyName: "salesOrder_quoteId_fkey"- columns: ["quoteId"]- isOneToOne: false- referencedRelation: "quote"- referencedColumns: ["id"]- },- {- foreignKeyName: "salesOrder_quoteId_fkey"- columns: ["quoteId"]- isOneToOne: false- referencedRelation: "quoteCustomerDetails"- referencedColumns: ["quoteId"]- },- {- foreignKeyName: "salesOrder_quoteId_fkey"- columns: ["quoteId"]- isOneToOne: false- referencedRelation: "quotes"- referencedColumns: ["id"]- },{foreignKeyName: "salesOrder_updatedBy_fkey"columns: ["updatedBy"]@@ -22769,6 +22883,7 @@ export type Database = {customerPartRevision: string | nullcustomFields: Json | nulldescription: string | null+ estimatorId: string | nullid: string | nullitemId: string | nullitemReadableId: string | null@@ -22850,6 +22965,41 @@ export type Database = {referencedRelation: "userDefaults"referencedColumns: ["userId"]},+ {+ foreignKeyName: "quoteLine_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteLine_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },{foreignKeyName: "quoteLine_itemId_fkey"columns: ["itemId"]@@ -22940,17 +23090,19 @@ export type Database = {customerLocationId: string | nullcustomerReference: string | nullcustomFields: Json | null+ estimatorId: string | nullexpirationDate: string | nullfavorite: boolean | nullid: string | nullitemIds: string[] | nulllocationId: string | nulllocationName: string | null- name: string | null- notes: string | null+ notes: Json | nullquoteDate: string | nullquoteId: string | nullrevisionId: number | null+ salesPersonId: string | null+ salesRfqId: string | nullstatus: Database["public"]["Enums"]["quoteStatus"] | nullupdatedAt: string | nullupdatedBy: string | null@@ -23089,6 +23241,41 @@ export type Database = {referencedRelation: "customerLocation"referencedColumns: ["id"]},+ {+ foreignKeyName: "quote_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quote_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quote_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quote_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quote_estimatorId_fkey"+ columns: ["estimatorId"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },{foreignKeyName: "quote_locationId_fkey"columns: ["locationId"]@@ -23117,6 +23304,55 @@ export type Database = {referencedRelation: "salesOrders"referencedColumns: ["locationId"]},+ {+ foreignKeyName: "quote_salesPersonId_fkey"+ columns: ["salesPersonId"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quote_salesPersonId_fkey"+ columns: ["salesPersonId"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quote_salesPersonId_fkey"+ columns: ["salesPersonId"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quote_salesPersonId_fkey"+ columns: ["salesPersonId"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quote_salesPersonId_fkey"+ columns: ["salesPersonId"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "quote_salesRfqId_fkey"+ columns: ["salesRfqId"]+ isOneToOne: false+ referencedRelation: "salesRfq"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quote_salesRfqId_fkey"+ columns: ["salesRfqId"]+ isOneToOne: false+ referencedRelation: "salesRfqs"+ referencedColumns: ["id"]+ },{foreignKeyName: "quote_updatedBy_fkey"columns: ["updatedBy"]@@ -23626,7 +23862,6 @@ export type Database = {notes: string | nullorderDate: string | nullpaymentTermName: string | null- quoteId: string | nullreceiptPromisedDate: string | nullreceiptRequestedDate: string | nullrevisionId: number | null@@ -23815,27 +24050,6 @@ export type Database = {referencedRelation: "customerLocation"referencedColumns: ["id"]},- {- foreignKeyName: "salesOrder_quoteId_fkey"- columns: ["quoteId"]- isOneToOne: false- referencedRelation: "quote"- referencedColumns: ["id"]- },- {- foreignKeyName: "salesOrder_quoteId_fkey"- columns: ["quoteId"]- isOneToOne: false- referencedRelation: "quoteCustomerDetails"- referencedColumns: ["quoteId"]- },- {- foreignKeyName: "salesOrder_quoteId_fkey"- columns: ["quoteId"]- isOneToOne: false- referencedRelation: "quotes"- referencedColumns: ["id"]- },{foreignKeyName: "salesOrder_updatedBy_fkey"columns: ["updatedBy"]diff --git a/packages/database/supabase/migrations/20240324175747_assignee.sql b/packages/database/supabase/migrations/20240324175747_assignee.sqlindex 891e4d92a1..d29171d6b2 100644--- a/packages/database/supabase/migrations/20240324175747_assignee.sql+++ b/packages/database/supabase/migrations/20240324175747_assignee.sql@@ -86,24 +86,7 @@ CREATE OR REPLACE VIEW "purchaseInvoices" WITH(SECURITY_INVOKER=true) ASFROM "purchaseInvoice" piLEFT JOIN "paymentTerm" pt ON pt."id" = pi."paymentTermId";-DROP VIEW "quotes";-ALTER TABLE "quote" DROP COLUMN "ownerId";-CREATE OR REPLACE VIEW "quotes" WITH(SECURITY_INVOKER=true) AS- SELECT- q.*,- l."name" AS "locationName",- ql."itemIds",- EXISTS(SELECT 1 FROM "quoteFavorite" pf WHERE pf."quoteId" = q.id AND pf."userId" = auth.uid()::text) AS favorite- FROM "quote" q- LEFT JOIN (- SELECT- "quoteId",- array_agg("itemId") AS "itemIds"- FROM "quoteLine"- GROUP BY "quoteId"- ) ql ON ql."quoteId" = q.id- LEFT JOIN "location" l- ON l.id = q."locationId";+DROP VIEW "receipts";CREATE OR REPLACE VIEW "receipts" WITH(SECURITY_INVOKER=true) ASdiff --git a/packages/database/supabase/migrations/20240412224648_sales-orders.sql b/packages/database/supabase/migrations/20240412224648_sales-orders.sqlindex a69dda7869..facb4b6902 100644--- a/packages/database/supabase/migrations/20240412224648_sales-orders.sql+++ b/packages/database/supabase/migrations/20240412224648_sales-orders.sql@@ -20,7 +20,7 @@ CREATE TABLE "salesOrder" ("customerLocationId" TEXT,"customerContactId" TEXT,"customerReference" TEXT,- "quoteId" TEXT,+ -- "quoteId" TEXT,"assignee" TEXT,"companyId" TEXT NOT NULL,"closedAt" DATE,@@ -38,7 +38,7 @@ CREATE TABLE "salesOrder" (CONSTRAINT "salesOrder_currencyCode_fkey" FOREIGN KEY ("currencyCode", "companyId") REFERENCES "currency" ("code", "companyId") ON DELETE RESTRICT,CONSTRAINT "salesOrder_customerLocationId_fkey" FOREIGN KEY ("customerLocationId") REFERENCES "customerLocation" ("id") ON UPDATE CASCADE ON DELETE RESTRICT,CONSTRAINT "salesOrder_customerContactId_fkey" FOREIGN KEY ("customerContactId") REFERENCES "customerContact" ("id") ON UPDATE CASCADE ON DELETE RESTRICT,- CONSTRAINT "salesOrder_quoteId_fkey" FOREIGN KEY ("quoteId") REFERENCES "quote"("id") ON UPDATE CASCADE ON DELETE RESTRICT,+ -- CONSTRAINT "salesOrder_quoteId_fkey" FOREIGN KEY ("quoteId") REFERENCES "quote"("id") ON UPDATE CASCADE ON DELETE RESTRICT,CONSTRAINT "salesOrder_assignee_fkey" FOREIGN KEY ("assignee") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE CASCADE,CONSTRAINT "salesOrder_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company" ("id") ON DELETE CASCADE ON UPDATE CASCADE,CONSTRAINT "salesOrder_closedBy_fkey" FOREIGN KEY ("closedBy") REFERENCES "user" ("id") ON DELETE RESTRICT,@@ -49,7 +49,7 @@ CREATE TABLE "salesOrder" (CREATE INDEX "salesOrder_salesOrderId_idx" ON "salesOrder" ("salesOrderId", "companyId");CREATE INDEX "salesOrder_customerId_idx" ON "salesOrder" ("customerId", "companyId");CREATE INDEX "salesOrder_status_idx" ON "salesOrder" ("status", "companyId");-CREATE INDEX "salesOrder_quoteId_idx" ON "salesOrder" ("quoteId", "companyId");+-- CREATE INDEX "salesOrder_quoteId_idx" ON "salesOrder" ("quoteId", "companyId");CREATE INDEX "salesOrder_companyId_idx" ON "salesOrder" ("companyId");CREATE TYPE "salesOrderLineType" AS ENUM (diff --git a/packages/database/supabase/migrations/20240206224405_quotes.sql b/packages/database/supabase/migrations/20240715024405_quotes.sqlsimilarity index 72%rename from packages/database/supabase/migrations/20240206224405_quotes.sqlrename to packages/database/supabase/migrations/20240715024405_quotes.sqlindex 547a6d57b2..2bcac5c12b 100644--- a/packages/database/supabase/migrations/20240206224405_quotes.sql+++ b/packages/database/supabase/migrations/20240715024405_quotes.sql@@ -15,12 +15,13 @@ CREATE TABLE "quote" ("id" TEXT NOT NULL DEFAULT xid(),"quoteId" TEXT NOT NULL,"revisionId" INTEGER NOT NULL DEFAULT 0,- "ownerId" TEXT NOT NULL,- "name" TEXT,- "status" "quoteStatus" NOT NULL DEFAULT 'Draft',+ "salesRfqId" TEXT,"quoteDate" DATE,"expirationDate" DATE,- "notes" TEXT,+ "status" "quoteStatus" NOT NULL DEFAULT 'Draft',+ "notes" JSON DEFAULT '{}'::json,+ "salesPersonId" TEXT,+ "estimatorId" TEXT,"customerId" TEXT NOT NULL,"customerLocationId" TEXT,"customerContactId" TEXT,@@ -36,11 +37,13 @@ CREATE TABLE "quote" (CONSTRAINT "quote_pkey" PRIMARY KEY ("id"),CONSTRAINT "quote_quoteId_key" UNIQUE ("quoteId", "companyId"),- CONSTRAINT "quote_ownerId_fkey" FOREIGN KEY ("ownerId") REFERENCES "user" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "quote_salesRfqId_fkey" FOREIGN KEY ("salesRfqId") REFERENCES "salesRfq" ("id") ON DELETE SET NULL ON UPDATE CASCADE,CONSTRAINT "quote_customerId_fkey" FOREIGN KEY ("customerId") REFERENCES "customer" ("id") ON DELETE CASCADE ON UPDATE CASCADE,CONSTRAINT "quote_customerLocationId_fkey" FOREIGN KEY ("customerLocationId") REFERENCES "customerLocation" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,CONSTRAINT "quote_customerContactId_fkey" FOREIGN KEY ("customerContactId") REFERENCES "customerContact" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,CONSTRAINT "quote_locationId_fkey" FOREIGN KEY ("locationId") REFERENCES "location" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "quote_salesPersonId_fkey" FOREIGN KEY ("salesPersonId") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE CASCADE,+ CONSTRAINT "quote_estimatorId_fkey" FOREIGN KEY ("estimatorId") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE CASCADE,CONSTRAINT "quote_assignee_fkey" FOREIGN KEY ("assignee") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE CASCADE,CONSTRAINT "quote_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,CONSTRAINT "quote_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,@@ -48,7 +51,6 @@ CREATE TABLE "quote" ();CREATE INDEX "quote_quoteId_idx" ON "quote" ("quoteId", "companyId");-CREATE INDEX "quote_ownerId_idx" ON "quote" ("ownerId", "companyId");CREATE INDEX "quote_customerId_idx" ON "quote" ("customerId", "companyId");CREATE INDEX "quote_locationId_idx" ON "quote" ("locationId", "companyId");CREATE INDEX "quote_companyId_idx" ON "quote" ("companyId");@@ -64,6 +66,7 @@ CREATE TABLE "quoteLine" ("quoteId" TEXT NOT NULL,"quoteRevisionId" INTEGER NOT NULL DEFAULT 0,"status" "quoteLineStatus" NOT NULL DEFAULT 'Draft',+ "estimatorId" TEXT,"itemId" TEXT NOT NULL,"itemReadableId" TEXT,"description" TEXT NOT NULL,@@ -79,6 +82,7 @@ CREATE TABLE "quoteLine" (CONSTRAINT "quoteLine_pkey" PRIMARY KEY ("id"),CONSTRAINT "quoteLine_quoteId_fkey" FOREIGN KEY ("quoteId") REFERENCES "quote" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "quoteLine_estimatorId_fkey" FOREIGN KEY ("estimatorId") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE CASCADE,CONSTRAINT "quoteLine_itemId_fkey" FOREIGN KEY ("itemId") REFERENCES "item" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,CONSTRAINT "quoteLine_unitOfMeasureCode_fkey" FOREIGN KEY ("unitOfMeasureCode", "companyId") REFERENCES "unitOfMeasure" ("code", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,CONSTRAINT "quoteLine_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,@@ -88,11 +92,42 @@ CREATE TABLE "quoteLine" (CREATE INDEX "quoteLine_quoteId_idx" ON "quoteLine" ("quoteId");-CREATE TABLE "quoteAssembly" (+CREATE TABLE "quoteMaterial" ("id" TEXT NOT NULL DEFAULT xid(),"quoteId" TEXT NOT NULL,"quoteLineId" TEXT NOT NULL,- "parentAssemblyId" TEXT,+ "itemId" TEXT NOT NULL,+ "description" TEXT NOT NULL,+ "quantity" NUMERIC(10, 2) NOT NULL DEFAULT 0,+ "unitOfMeasureCode" TEXT,+ "unitCost" NUMERIC(10, 2) NOT NULL DEFAULT 0,+ "companyId" TEXT NOT NULL,+ "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),+ "createdBy" TEXT NOT NULL,+ "updatedAt" TIMESTAMP WITH TIME ZONE,+ "updatedBy" TEXT,+ "customFields" JSONB,++ CONSTRAINT "quoteMaterial_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "quoteMaterial_quoteId_fkey" FOREIGN KEY ("quoteId") REFERENCES "quote" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "quoteMaterial_quoteLineId_fkey" FOREIGN KEY ("quoteLineId") REFERENCES "quoteLine" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "quoteMaterial_itemId_fkey" FOREIGN KEY ("itemId") REFERENCES "item" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "quoteMaterial_unitOfMeasureCode_fkey" FOREIGN KEY ("unitOfMeasureCode", "companyId") REFERENCES "unitOfMeasure" ("code", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "quoteMaterial_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "quoteMaterial_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "quoteMaterial_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE RESTRICT ON UPDATE CASCADE+);++CREATE INDEX "quoteMaterial_quoteId_idx" ON "quoteMaterial" ("quoteId");+CREATE INDEX "quoteMaterial_quoteLineId_idx" ON "quoteMaterial" ("quoteLineId");++++CREATE TABLE "quoteMakeMethod" (+ "id" TEXT NOT NULL DEFAULT xid(),+ "quoteId" TEXT NOT NULL,+ "quoteLineId" TEXT NOT NULL,+ "parentMaterialId" TEXT,"itemId" TEXT NOT NULL,"description" TEXT,"unitOfMeasureCode" TEXT,@@ -104,26 +139,29 @@ CREATE TABLE "quoteAssembly" ("updatedBy" TEXT,"customFields" JSONB,- CONSTRAINT "quoteAssembly_pkey" PRIMARY KEY ("id"),- CONSTRAINT "quoteAssembly_quoteId_fkey" FOREIGN KEY ("quoteId") REFERENCES "quote" ("id") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "quoteAssembly_quoteLineId_fkey" FOREIGN KEY ("quoteLineId") REFERENCES "quoteLine" ("id") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "quoteAssembly_parentAssemblyId_fkey" FOREIGN KEY ("parentAssemblyId") REFERENCES "quoteAssembly" ("id") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "quoteAssembly_itemId_fkey" FOREIGN KEY ("itemId") REFERENCES "item" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "quoteAssembly_unitOfMeasureCode_fkey" FOREIGN KEY ("unitOfMeasureCode", "companyId") REFERENCES "unitOfMeasure" ("code", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "quoteAssembly_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "quoteAssembly_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "quoteAssembly_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE RESTRICT ON UPDATE CASCADE+ CONSTRAINT "quoteMakeMethod_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "quoteMakeMethod_quoteId_fkey" FOREIGN KEY ("quoteId") REFERENCES "quote" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "quoteMakeMethod_quoteLineId_fkey" FOREIGN KEY ("quoteLineId") REFERENCES "quoteLine" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "quoteMakeMethod_parentMaterialId_fkey" FOREIGN KEY ("parentMaterialId") REFERENCES "quoteMaterial" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "quoteMakeMethod_itemId_fkey" FOREIGN KEY ("itemId") REFERENCES "item" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "quoteMakeMethod_unitOfMeasureCode_fkey" FOREIGN KEY ("unitOfMeasureCode", "companyId") REFERENCES "unitOfMeasure" ("code", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "quoteMakeMethod_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "quoteMakeMethod_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "quoteMakeMethod_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE RESTRICT ON UPDATE CASCADE);-CREATE INDEX "quoteAssembly_quoteId_idx" ON "quoteAssembly" ("quoteId");-CREATE INDEX "quoteAssembly_quoteLineId_idx" ON "quoteAssembly" ("quoteLineId");-CREATE INDEX "quoteAssembly_parentAssemblyId_idx" ON "quoteAssembly" ("parentAssemblyId");+CREATE INDEX "quoteMakeMethod_quoteId_idx" ON "quoteMakeMethod" ("quoteId");+CREATE INDEX "quoteMakeMethod_quoteLineId_idx" ON "quoteMakeMethod" ("quoteLineId");+CREATE INDEX "quoteMakeMethod_parentMaterialId_idx" ON "quoteMakeMethod" ("parentMaterialId");++ALTER TABLE "quoteMaterial" ADD COLUMN "quoteMakeMethodId" TEXT,+ ADD CONSTRAINT "quoteMaterial_quoteMakeMethodId_fkey" FOREIGN KEY ("quoteMakeMethodId") REFERENCES "quoteMakeMethod" ("id") ON DELETE CASCADE ON UPDATE CASCADE;CREATE TABLE "quoteOperation" ("id" TEXT NOT NULL DEFAULT xid(),"quoteId" TEXT NOT NULL,"quoteLineId" TEXT NOT NULL,- "quoteAssemblyId" TEXT,+ "quoteMakeMethodId" TEXT,"workCellTypeId" TEXT NOT NULL,"equipmentTypeId" TEXT,"description" TEXT,@@ -143,7 +181,7 @@ CREATE TABLE "quoteOperation" (CONSTRAINT "quoteOperation_pkey" PRIMARY KEY ("id"),CONSTRAINT "quoteOperation_quoteId_fkey" FOREIGN KEY ("quoteId") REFERENCES "quote" ("id") ON DELETE CASCADE ON UPDATE CASCADE,CONSTRAINT "quoteOperation_quoteLineId_fkey" FOREIGN KEY ("quoteLineId") REFERENCES "quoteLine" ("id") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "quoteOperation_quoteAssemblyId_fkey" FOREIGN KEY ("quoteAssemblyId") REFERENCES "quoteAssembly" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "quoteOperation_quoteMakeMethodId_fkey" FOREIGN KEY ("quoteMakeMethodId") REFERENCES "quoteMakeMethod" ("id") ON DELETE CASCADE ON UPDATE CASCADE,CONSTRAINT "quoteOperation_workCellTypeId_fkey" FOREIGN KEY ("workCellTypeId") REFERENCES "workCellType" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,CONSTRAINT "quoteOperation_equipmentTypeId_fkey" FOREIGN KEY ("equipmentTypeId") REFERENCES "equipmentType" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,CONSTRAINT "quoteOperation_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,@@ -153,38 +191,11 @@ CREATE TABLE "quoteOperation" (CREATE INDEX "quoteOperation_quoteId_idx" ON "quoteOperation" ("quoteId");CREATE INDEX "quoteOperation_quoteLineId_idx" ON "quoteOperation" ("quoteLineId");-CREATE INDEX "quoteOperation_quoteAssemblyId_idx" ON "quoteOperation" ("quoteAssemblyId");--CREATE TABLE "quoteMaterial" (- "id" TEXT NOT NULL DEFAULT xid(),- "quoteId" TEXT NOT NULL,- "quoteLineId" TEXT NOT NULL,- "quoteOperationId" TEXT NOT NULL,- "itemId" TEXT NOT NULL,- "description" TEXT NOT NULL,- "quantity" NUMERIC(10, 2) NOT NULL DEFAULT 0,- "unitOfMeasureCode" TEXT,- "unitCost" NUMERIC(10, 2) NOT NULL DEFAULT 0,- "companyId" TEXT NOT NULL,- "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),- "createdBy" TEXT NOT NULL,- "updatedAt" TIMESTAMP WITH TIME ZONE,- "updatedBy" TEXT,- "customFields" JSONB,+CREATE INDEX "quoteOperation_quoteMakeMethodId_idx" ON "quoteOperation" ("quoteMakeMethodId");- CONSTRAINT "quoteMaterial_pkey" PRIMARY KEY ("id"),- CONSTRAINT "quoteMaterial_quoteId_fkey" FOREIGN KEY ("quoteId") REFERENCES "quote" ("id") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "quoteMaterial_quoteLineId_fkey" FOREIGN KEY ("quoteLineId") REFERENCES "quoteLine" ("id") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "quoteMaterial_quoteOperationId_fkey" FOREIGN KEY ("quoteOperationId") REFERENCES "quoteOperation" ("id") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "quoteMaterial_itemId_fkey" FOREIGN KEY ("itemId") REFERENCES "item" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "quoteMaterial_unitOfMeasureCode_fkey" FOREIGN KEY ("unitOfMeasureCode", "companyId") REFERENCES "unitOfMeasure" ("code", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "quoteMaterial_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "quoteMaterial_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "quoteMaterial_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE RESTRICT ON UPDATE CASCADE-);+ALTER TABLE "quoteMaterial" ADD COLUMN "quoteOperationId" TEXT,+ ADD CONSTRAINT "quoteMaterial_quoteOperationId_fkey" FOREIGN KEY ("quoteOperationId") REFERENCES "quoteOperation" ("id") ON DELETE CASCADE ON UPDATE CASCADE;-CREATE INDEX "quoteMaterial_quoteId_idx" ON "quoteMaterial" ("quoteId");-CREATE INDEX "quoteMaterial_quoteLineId_idx" ON "quoteMaterial" ("quoteLineId");CREATE INDEX "quoteMaterial_quoteOperationId_idx" ON "quoteMaterial" ("quoteOperationId");CREATE TABLE "quoteFavorite" (@@ -218,67 +229,17 @@ CREATE POLICY "Users can delete their own quote favorites" ON "quoteFavorite"CREATE OR REPLACE VIEW "quotes" WITH(SECURITY_INVOKER=true) ASSELECT- q."id",- q."quoteId",- q."customerId",- q."customerLocationId",- q."customerContactId",- q."name",- q."status",- q."notes",- q."quoteDate",- q."expirationDate",- q."customerReference",- q."locationId",- q."createdAt",- q."createdBy",- q."ownerId",- q."customFields",- q."companyId",- uo."fullName" AS "ownerFullName",- uo."avatarUrl" AS "ownerAvatar",- c."name" AS "customerName",- uc."fullName" AS "createdByFullName",- uc."avatarUrl" AS "createdByAvatar",- uu."fullName" AS "updatedByFullName",- uu."avatarUrl" AS "updatedByAvatar",+ q.*,l."name" AS "locationName",- array_agg(ql."itemId") AS "itemIds",+ ql."itemIds",EXISTS(SELECT 1 FROM "quoteFavorite" pf WHERE pf."quoteId" = q.id AND pf."userId" = auth.uid()::text) AS favorite-FROM "quote" q-LEFT JOIN "customer" c- ON c.id = q."customerId"-LEFT JOIN "location" l- ON l.id = q."locationId"-LEFT JOIN "quoteLine" ql- ON ql."quoteId" = q.id-LEFT JOIN "user" uo- ON uo.id = q."ownerId"-LEFT JOIN "user" uc- ON uc.id = q."createdBy"-LEFT JOIN "user" uu- ON uu.id = q."updatedBy"-GROUP BY- q."id",- q."quoteId",- q."customerId",- q."customerLocationId",- q."customerContactId",- q."name",- q."status",- q."notes",- q."quoteDate",- q."expirationDate",- q."customerReference",- q."locationId",- q."createdAt",- q."createdBy",- q."customFields",- c."name",- uo."fullName",- uo."avatarUrl",- uc."fullName",- uc."avatarUrl",- uu."fullName",- uu."avatarUrl",- l."name";\ No newline at end of file+ FROM "quote" q+ LEFT JOIN (+ SELECT+ "quoteId",+ array_agg("itemId") AS "itemIds"+ FROM "quoteLine"+ GROUP BY "quoteId"+ ) ql ON ql."quoteId" = q.id+ LEFT JOIN "location" l+ ON l.id = q."locationId";\ No newline at end of filediff --git a/packages/database/supabase/migrations/20240213043906_quote-rls.sql b/packages/database/supabase/migrations/20240715043906_quote-rls.sqlsimilarity index 94%rename from packages/database/supabase/migrations/20240213043906_quote-rls.sqlrename to packages/database/supabase/migrations/20240715043906_quote-rls.sqlindex 3abe8b4ffa..21800bc2de 100644--- a/packages/database/supabase/migrations/20240213043906_quote-rls.sql+++ b/packages/database/supabase/migrations/20240715043906_quote-rls.sql@@ -153,16 +153,16 @@ CREATE POLICY "Customers with sales_delete can delete lines on their own quote"));-ALTER TABLE "quoteAssembly" ENABLE ROW LEVEL SECURITY;+ALTER TABLE "quoteMakeMethod" ENABLE ROW LEVEL SECURITY;-CREATE POLICY "Employees with sales_view can view quote assemblies" ON "quoteAssembly"+CREATE POLICY "Employees with sales_view can view quote make methods" ON "quoteMakeMethod"FOR SELECTUSING (has_role('employee', get_company_id_from_foreign_key("quoteId", 'quote')) ANDhas_company_permission('sales_view', get_company_id_from_foreign_key("quoteId", 'quote')));-CREATE POLICY "Customers with sales_view can their own quote assemblies" ON "quoteAssembly"+CREATE POLICY "Customers with sales_view can their own quote make methods" ON "quoteMakeMethod"FOR SELECTUSING (has_role('customer', get_company_id_from_foreign_key("quoteId", 'quote')) AND@@ -176,21 +176,21 @@ CREATE POLICY "Customers with sales_view can their own quote assemblies" ON "quo));-CREATE POLICY "Employees with sales_create can create quote assemblies" ON "quoteAssembly"+CREATE POLICY "Employees with sales_create can create quote make methods" ON "quoteMakeMethod"FOR INSERTWITH CHECK (has_role('employee', get_company_id_from_foreign_key("quoteId", 'quote')) ANDhas_company_permission('sales_create', get_company_id_from_foreign_key("quoteId", 'quote')));-CREATE POLICY "Employees with sales_update can update quote assemblies" ON "quoteAssembly"+CREATE POLICY "Employees with sales_update can update quote make methods" ON "quoteMakeMethod"FOR UPDATEUSING (has_role('employee', get_company_id_from_foreign_key("quoteId", 'quote')) ANDhas_company_permission('sales_update', get_company_id_from_foreign_key("quoteId", 'quote')));-CREATE POLICY "Employees with sales_delete can delete quote assemblies" ON "quoteAssembly"+CREATE POLICY "Employees with sales_delete can delete quote make methods" ON "quoteMakeMethod"FOR DELETEUSING (has_role('employee', get_company_id_from_foreign_key("quoteId", 'quote')) ANDdiff --git a/packages/database/supabase/migrations/20240209055738_quote-files.sql b/packages/database/supabase/migrations/20240715055738_quote-files.sqlsimilarity index 100%rename from packages/database/supabase/migrations/20240209055738_quote-files.sqlrename to packages/database/supabase/migrations/20240715055738_quote-files.sqldiff --git a/packages/database/supabase/migrations/20240329034816_quote-pricing.sql b/packages/database/supabase/migrations/20240715134816_quote-pricing.sqlsimilarity index 100%rename from packages/database/supabase/migrations/20240329034816_quote-pricing.sqlrename to packages/database/supabase/migrations/20240715134816_quote-pricing.sqldiff --git a/packages/database/supabase/migrations/20240321035710_quote-locations.sql b/packages/database/supabase/migrations/20240715135710_quote-locations.sqlsimilarity index 100%rename from packages/database/supabase/migrations/20240321035710_quote-locations.sqlrename to packages/database/supabase/migrations/20240715135710_quote-locations.sql