task-d5.5.1
This commit is contained in:
@@ -226,7 +226,36 @@ CREATE TABLE "crm_document_templates" (
|
||||
"updated_by" text NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "crm_enquiries" (
|
||||
CREATE TABLE "crm_leads" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"organization_id" text NOT NULL,
|
||||
"branch_id" text,
|
||||
"code" text NOT NULL,
|
||||
"customer_id" text,
|
||||
"contact_id" text,
|
||||
"description" text,
|
||||
"project_name" text,
|
||||
"project_location" text,
|
||||
"product_type" text,
|
||||
"priority" text,
|
||||
"estimated_value" double precision,
|
||||
"awareness_id" text,
|
||||
"status" text DEFAULT 'new_job' NOT NULL,
|
||||
"followup_status" text,
|
||||
"lost_reason" text,
|
||||
"outcome" text DEFAULT 'open' NOT NULL,
|
||||
"owner_marketing_user_id" text,
|
||||
"assigned_sales_owner_id" text,
|
||||
"assigned_at" timestamp with time zone,
|
||||
"assigned_by" text,
|
||||
"assignment_remark" text,
|
||||
"created_by" text NOT NULL,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"deleted_at" timestamp with time zone
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "crm_opportunities" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"organization_id" text NOT NULL,
|
||||
"branch_id" text,
|
||||
@@ -273,10 +302,10 @@ CREATE TABLE "crm_enquiries" (
|
||||
"updated_by" text NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "crm_enquiry_attachments" (
|
||||
CREATE TABLE "crm_opportunity_attachments" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"organization_id" text NOT NULL,
|
||||
"enquiry_id" text NOT NULL,
|
||||
"opportunity_id" text NOT NULL,
|
||||
"category" text NOT NULL,
|
||||
"file_name" text NOT NULL,
|
||||
"original_file_name" text NOT NULL,
|
||||
@@ -292,10 +321,10 @@ CREATE TABLE "crm_enquiry_attachments" (
|
||||
"deleted_at" timestamp with time zone
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "crm_enquiry_customers" (
|
||||
CREATE TABLE "crm_opportunity_customers" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"organization_id" text NOT NULL,
|
||||
"enquiry_id" text NOT NULL,
|
||||
"opportunity_id" text NOT NULL,
|
||||
"customer_id" text NOT NULL,
|
||||
"role" text NOT NULL,
|
||||
"remark" text,
|
||||
@@ -304,10 +333,10 @@ CREATE TABLE "crm_enquiry_customers" (
|
||||
"deleted_at" timestamp with time zone
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "crm_enquiry_followups" (
|
||||
CREATE TABLE "crm_opportunity_followups" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"organization_id" text NOT NULL,
|
||||
"enquiry_id" text NOT NULL,
|
||||
"opportunity_id" text NOT NULL,
|
||||
"followup_date" timestamp with time zone NOT NULL,
|
||||
"followup_type" text NOT NULL,
|
||||
"contact_id" text,
|
||||
@@ -322,35 +351,6 @@ CREATE TABLE "crm_enquiry_followups" (
|
||||
"updated_by" text NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "crm_leads" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"organization_id" text NOT NULL,
|
||||
"branch_id" text,
|
||||
"code" text NOT NULL,
|
||||
"customer_id" text,
|
||||
"contact_id" text,
|
||||
"description" text,
|
||||
"project_name" text,
|
||||
"project_location" text,
|
||||
"product_type" text,
|
||||
"priority" text,
|
||||
"estimated_value" double precision,
|
||||
"awareness_id" text,
|
||||
"status" text DEFAULT 'new_job' NOT NULL,
|
||||
"followup_status" text,
|
||||
"lost_reason" text,
|
||||
"outcome" text DEFAULT 'open' NOT NULL,
|
||||
"owner_marketing_user_id" text,
|
||||
"assigned_sales_owner_id" text,
|
||||
"assigned_at" timestamp with time zone,
|
||||
"assigned_by" text,
|
||||
"assignment_remark" text,
|
||||
"created_by" text NOT NULL,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"deleted_at" timestamp with time zone
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "crm_quotation_attachments" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"organization_id" text NOT NULL,
|
||||
@@ -448,7 +448,7 @@ CREATE TABLE "crm_quotations" (
|
||||
"organization_id" text NOT NULL,
|
||||
"branch_id" text,
|
||||
"code" text NOT NULL,
|
||||
"enquiry_id" text,
|
||||
"opportunity_id" text,
|
||||
"customer_id" text NOT NULL,
|
||||
"contact_id" text,
|
||||
"quotation_date" timestamp with time zone NOT NULL,
|
||||
@@ -645,8 +645,8 @@ CREATE UNIQUE INDEX "crm_document_template_mappings_version_placeholder_idx" ON
|
||||
CREATE UNIQUE INDEX "crm_document_template_table_columns_mapping_name_idx" ON "crm_document_template_table_columns" USING btree ("mapping_id","column_name");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "crm_document_template_versions_template_version_idx" ON "crm_document_template_versions" USING btree ("template_id","version");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "crm_document_templates_org_doc_product_file_name_idx" ON "crm_document_templates" USING btree ("organization_id","document_type","product_type","file_type","template_name");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "crm_enquiries_org_code_idx" ON "crm_enquiries" USING btree ("organization_id","code");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "crm_leads_org_code_idx" ON "crm_leads" USING btree ("organization_id","code");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "crm_opportunities_org_code_idx" ON "crm_opportunities" USING btree ("organization_id","code");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "crm_quotations_org_code_idx" ON "crm_quotations" USING btree ("organization_id","code");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "crm_report_definitions_org_code_idx" ON "crm_report_definitions" USING btree ("organization_id","code");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "crm_role_profiles_org_code_idx" ON "crm_role_profiles" USING btree ("organization_id","code");--> statement-breakpoint
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"id": "5b317a18-e2f9-48c7-a371-c6a972e13344",
|
||||
"id": "e01a80c3-a4b5-4461-afb0-52b663dfa084",
|
||||
"prevId": "00000000-0000-0000-0000-000000000000",
|
||||
"version": "7",
|
||||
"dialect": "postgresql",
|
||||
@@ -1551,8 +1551,203 @@
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.crm_enquiries": {
|
||||
"name": "crm_enquiries",
|
||||
"public.crm_leads": {
|
||||
"name": "crm_leads",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true
|
||||
},
|
||||
"organization_id": {
|
||||
"name": "organization_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"branch_id": {
|
||||
"name": "branch_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"code": {
|
||||
"name": "code",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"customer_id": {
|
||||
"name": "customer_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"contact_id": {
|
||||
"name": "contact_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"description": {
|
||||
"name": "description",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"project_name": {
|
||||
"name": "project_name",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"project_location": {
|
||||
"name": "project_location",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"product_type": {
|
||||
"name": "product_type",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"priority": {
|
||||
"name": "priority",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"estimated_value": {
|
||||
"name": "estimated_value",
|
||||
"type": "double precision",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"awareness_id": {
|
||||
"name": "awareness_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"status": {
|
||||
"name": "status",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'new_job'"
|
||||
},
|
||||
"followup_status": {
|
||||
"name": "followup_status",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"lost_reason": {
|
||||
"name": "lost_reason",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"outcome": {
|
||||
"name": "outcome",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'open'"
|
||||
},
|
||||
"owner_marketing_user_id": {
|
||||
"name": "owner_marketing_user_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"assigned_sales_owner_id": {
|
||||
"name": "assigned_sales_owner_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"assigned_at": {
|
||||
"name": "assigned_at",
|
||||
"type": "timestamp with time zone",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"assigned_by": {
|
||||
"name": "assigned_by",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"assignment_remark": {
|
||||
"name": "assignment_remark",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"created_by": {
|
||||
"name": "created_by",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"created_at": {
|
||||
"name": "created_at",
|
||||
"type": "timestamp with time zone",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "now()"
|
||||
},
|
||||
"updated_at": {
|
||||
"name": "updated_at",
|
||||
"type": "timestamp with time zone",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "now()"
|
||||
},
|
||||
"deleted_at": {
|
||||
"name": "deleted_at",
|
||||
"type": "timestamp with time zone",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"crm_leads_org_code_idx": {
|
||||
"name": "crm_leads_org_code_idx",
|
||||
"columns": [
|
||||
{
|
||||
"expression": "organization_id",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
},
|
||||
{
|
||||
"expression": "code",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
}
|
||||
],
|
||||
"isUnique": true,
|
||||
"concurrently": false,
|
||||
"method": "btree",
|
||||
"with": {}
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.crm_opportunities": {
|
||||
"name": "crm_opportunities",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
@@ -1826,8 +2021,8 @@
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"crm_enquiries_org_code_idx": {
|
||||
"name": "crm_enquiries_org_code_idx",
|
||||
"crm_opportunities_org_code_idx": {
|
||||
"name": "crm_opportunities_org_code_idx",
|
||||
"columns": [
|
||||
{
|
||||
"expression": "organization_id",
|
||||
@@ -1855,8 +2050,8 @@
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.crm_enquiry_attachments": {
|
||||
"name": "crm_enquiry_attachments",
|
||||
"public.crm_opportunity_attachments": {
|
||||
"name": "crm_opportunity_attachments",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
@@ -1871,8 +2066,8 @@
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"enquiry_id": {
|
||||
"name": "enquiry_id",
|
||||
"opportunity_id": {
|
||||
"name": "opportunity_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
@@ -1967,8 +2162,8 @@
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.crm_enquiry_customers": {
|
||||
"name": "crm_enquiry_customers",
|
||||
"public.crm_opportunity_customers": {
|
||||
"name": "crm_opportunity_customers",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
@@ -1983,8 +2178,8 @@
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"enquiry_id": {
|
||||
"name": "enquiry_id",
|
||||
"opportunity_id": {
|
||||
"name": "opportunity_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
@@ -2036,8 +2231,8 @@
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.crm_enquiry_followups": {
|
||||
"name": "crm_enquiry_followups",
|
||||
"public.crm_opportunity_followups": {
|
||||
"name": "crm_opportunity_followups",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
@@ -2052,8 +2247,8 @@
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"enquiry_id": {
|
||||
"name": "enquiry_id",
|
||||
"opportunity_id": {
|
||||
"name": "opportunity_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
@@ -2141,201 +2336,6 @@
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.crm_leads": {
|
||||
"name": "crm_leads",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true
|
||||
},
|
||||
"organization_id": {
|
||||
"name": "organization_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"branch_id": {
|
||||
"name": "branch_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"code": {
|
||||
"name": "code",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"customer_id": {
|
||||
"name": "customer_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"contact_id": {
|
||||
"name": "contact_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"description": {
|
||||
"name": "description",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"project_name": {
|
||||
"name": "project_name",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"project_location": {
|
||||
"name": "project_location",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"product_type": {
|
||||
"name": "product_type",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"priority": {
|
||||
"name": "priority",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"estimated_value": {
|
||||
"name": "estimated_value",
|
||||
"type": "double precision",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"awareness_id": {
|
||||
"name": "awareness_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"status": {
|
||||
"name": "status",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'new_job'"
|
||||
},
|
||||
"followup_status": {
|
||||
"name": "followup_status",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"lost_reason": {
|
||||
"name": "lost_reason",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"outcome": {
|
||||
"name": "outcome",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'open'"
|
||||
},
|
||||
"owner_marketing_user_id": {
|
||||
"name": "owner_marketing_user_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"assigned_sales_owner_id": {
|
||||
"name": "assigned_sales_owner_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"assigned_at": {
|
||||
"name": "assigned_at",
|
||||
"type": "timestamp with time zone",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"assigned_by": {
|
||||
"name": "assigned_by",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"assignment_remark": {
|
||||
"name": "assignment_remark",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"created_by": {
|
||||
"name": "created_by",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"created_at": {
|
||||
"name": "created_at",
|
||||
"type": "timestamp with time zone",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "now()"
|
||||
},
|
||||
"updated_at": {
|
||||
"name": "updated_at",
|
||||
"type": "timestamp with time zone",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "now()"
|
||||
},
|
||||
"deleted_at": {
|
||||
"name": "deleted_at",
|
||||
"type": "timestamp with time zone",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
}
|
||||
},
|
||||
"indexes": {
|
||||
"crm_leads_org_code_idx": {
|
||||
"name": "crm_leads_org_code_idx",
|
||||
"columns": [
|
||||
{
|
||||
"expression": "organization_id",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
},
|
||||
{
|
||||
"expression": "code",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
}
|
||||
],
|
||||
"isUnique": true,
|
||||
"concurrently": false,
|
||||
"method": "btree",
|
||||
"with": {}
|
||||
}
|
||||
},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {},
|
||||
"policies": {},
|
||||
"checkConstraints": {},
|
||||
"isRLSEnabled": false
|
||||
},
|
||||
"public.crm_quotation_attachments": {
|
||||
"name": "crm_quotation_attachments",
|
||||
"schema": "",
|
||||
@@ -2908,8 +2908,8 @@
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"enquiry_id": {
|
||||
"name": "enquiry_id",
|
||||
"opportunity_id": {
|
||||
"name": "opportunity_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
{
|
||||
"idx": 0,
|
||||
"version": "7",
|
||||
"when": 1782285058938,
|
||||
"tag": "0000_swift_prism",
|
||||
"when": 1782359607850,
|
||||
"tag": "0000_hard_butterfly",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user