{
  "id": "0237eb23-9304-48dd-a770-8bf5013172da",
  "prevId": "dae63ce5-8077-4920-abd6-a232df70e20a",
  "version": "7",
  "dialect": "postgresql",
  "tables": {
    "public.crm_approval_actions": {
      "name": "crm_approval_actions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "approval_request_id": {
          "name": "approval_request_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "step_number": {
          "name": "step_number",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "action": {
          "name": "action",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "remark": {
          "name": "remark",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "acted_by": {
          "name": "acted_by",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "acted_at": {
          "name": "acted_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "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": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.crm_approval_requests": {
      "name": "crm_approval_requests",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "workflow_id": {
          "name": "workflow_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "entity_type": {
          "name": "entity_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "entity_id": {
          "name": "entity_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "current_step": {
          "name": "current_step",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "requested_by": {
          "name": "requested_by",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "requested_at": {
          "name": "requested_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "completed_at": {
          "name": "completed_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "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": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.crm_approval_steps": {
      "name": "crm_approval_steps",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "workflow_id": {
          "name": "workflow_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "step_number": {
          "name": "step_number",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "role_code": {
          "name": "role_code",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "role_name": {
          "name": "role_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "is_required": {
          "name": "is_required",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": 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_approval_steps_workflow_step_idx": {
          "name": "crm_approval_steps_workflow_step_idx",
          "columns": [
            {
              "expression": "workflow_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "step_number",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.crm_approval_workflows": {
      "name": "crm_approval_workflows",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "code": {
          "name": "code",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "entity_type": {
          "name": "entity_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": 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_approval_workflows_org_code_idx": {
          "name": "crm_approval_workflows_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_customer_contacts": {
      "name": "crm_customer_contacts",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "customer_id": {
          "name": "customer_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "position": {
          "name": "position",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "department": {
          "name": "department",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "phone": {
          "name": "phone",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "mobile": {
          "name": "mobile",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_primary": {
          "name": "is_primary",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": 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
        },
        "created_by": {
          "name": "created_by",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "updated_by": {
          "name": "updated_by",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.crm_customers": {
      "name": "crm_customers",
      "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
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "abbr": {
          "name": "abbr",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "tax_id": {
          "name": "tax_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "customer_type": {
          "name": "customer_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "customer_status": {
          "name": "customer_status",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "address": {
          "name": "address",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "province": {
          "name": "province",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "district": {
          "name": "district",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "sub_district": {
          "name": "sub_district",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "postal_code": {
          "name": "postal_code",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "country": {
          "name": "country",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "phone": {
          "name": "phone",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "fax": {
          "name": "fax",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "website": {
          "name": "website",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "lead_channel": {
          "name": "lead_channel",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "customer_group": {
          "name": "customer_group",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": 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
        },
        "created_by": {
          "name": "created_by",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "updated_by": {
          "name": "updated_by",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {
        "crm_customers_org_code_idx": {
          "name": "crm_customers_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_document_template_mappings": {
      "name": "crm_document_template_mappings",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "template_version_id": {
          "name": "template_version_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "placeholder_key": {
          "name": "placeholder_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "source_path": {
          "name": "source_path",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "data_type": {
          "name": "data_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "sheet_name": {
          "name": "sheet_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "default_value": {
          "name": "default_value",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "format_mask": {
          "name": "format_mask",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "sort_order": {
          "name": "sort_order",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "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_document_template_mappings_version_placeholder_idx": {
          "name": "crm_document_template_mappings_version_placeholder_idx",
          "columns": [
            {
              "expression": "template_version_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "placeholder_key",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.crm_document_template_table_columns": {
      "name": "crm_document_template_table_columns",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "mapping_id": {
          "name": "mapping_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "column_name": {
          "name": "column_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "source_field": {
          "name": "source_field",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "column_letter": {
          "name": "column_letter",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "sort_order": {
          "name": "sort_order",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "format_mask": {
          "name": "format_mask",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "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_document_template_table_columns_mapping_name_idx": {
          "name": "crm_document_template_table_columns_mapping_name_idx",
          "columns": [
            {
              "expression": "mapping_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "column_name",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.crm_document_template_versions": {
      "name": "crm_document_template_versions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "template_id": {
          "name": "template_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "version": {
          "name": "version",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "file_path": {
          "name": "file_path",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "schema_json": {
          "name": "schema_json",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "preview_image_url": {
          "name": "preview_image_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": 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
        },
        "created_by": {
          "name": "created_by",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {
        "crm_document_template_versions_template_version_idx": {
          "name": "crm_document_template_versions_template_version_idx",
          "columns": [
            {
              "expression": "template_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "version",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.crm_document_templates": {
      "name": "crm_document_templates",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "document_type": {
          "name": "document_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "product_type": {
          "name": "product_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "file_type": {
          "name": "file_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "template_name": {
          "name": "template_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_default": {
          "name": "is_default",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": 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
        },
        "created_by": {
          "name": "created_by",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "updated_by": {
          "name": "updated_by",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {
        "crm_document_templates_org_doc_product_file_name_idx": {
          "name": "crm_document_templates_org_doc_product_file_name_idx",
          "columns": [
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "document_type",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "product_type",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "file_type",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "template_name",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.crm_enquiries": {
      "name": "crm_enquiries",
      "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": true
        },
        "contact_id": {
          "name": "contact_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "requirement": {
          "name": "requirement",
          "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": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "priority": {
          "name": "priority",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "lead_channel": {
          "name": "lead_channel",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "estimated_value": {
          "name": "estimated_value",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false
        },
        "chance_percent": {
          "name": "chance_percent",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "expected_close_date": {
          "name": "expected_close_date",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "competitor": {
          "name": "competitor",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "source": {
          "name": "source",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_hot_project": {
          "name": "is_hot_project",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "assigned_to_user_id": {
          "name": "assigned_to_user_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_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
        },
        "created_by": {
          "name": "created_by",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "updated_by": {
          "name": "updated_by",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {
        "crm_enquiries_org_code_idx": {
          "name": "crm_enquiries_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_enquiry_followups": {
      "name": "crm_enquiry_followups",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "enquiry_id": {
          "name": "enquiry_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "followup_date": {
          "name": "followup_date",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        },
        "followup_type": {
          "name": "followup_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "contact_id": {
          "name": "contact_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "outcome": {
          "name": "outcome",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "next_followup_date": {
          "name": "next_followup_date",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "next_action": {
          "name": "next_action",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "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
        },
        "created_by": {
          "name": "created_by",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "updated_by": {
          "name": "updated_by",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.crm_quotation_attachments": {
      "name": "crm_quotation_attachments",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "quotation_id": {
          "name": "quotation_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "file_name": {
          "name": "file_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "original_file_name": {
          "name": "original_file_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "file_path": {
          "name": "file_path",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "file_size": {
          "name": "file_size",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "file_type": {
          "name": "file_type",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "uploaded_at": {
          "name": "uploaded_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "uploaded_by": {
          "name": "uploaded_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": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.crm_quotation_customers": {
      "name": "crm_quotation_customers",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "quotation_id": {
          "name": "quotation_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "customer_id": {
          "name": "customer_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "role": {
          "name": "role",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "is_primary": {
          "name": "is_primary",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "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": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.crm_quotation_followups": {
      "name": "crm_quotation_followups",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "quotation_id": {
          "name": "quotation_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "followup_date": {
          "name": "followup_date",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        },
        "followup_type": {
          "name": "followup_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "contact_id": {
          "name": "contact_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "outcome": {
          "name": "outcome",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "next_followup_date": {
          "name": "next_followup_date",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "next_action": {
          "name": "next_action",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "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
        },
        "created_by": {
          "name": "created_by",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "updated_by": {
          "name": "updated_by",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.crm_quotation_items": {
      "name": "crm_quotation_items",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "quotation_id": {
          "name": "quotation_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "item_number": {
          "name": "item_number",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "product_type": {
          "name": "product_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "quantity": {
          "name": "quantity",
          "type": "double precision",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "unit": {
          "name": "unit",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "unit_price": {
          "name": "unit_price",
          "type": "double precision",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "discount": {
          "name": "discount",
          "type": "double precision",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "discount_type": {
          "name": "discount_type",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "tax_rate": {
          "name": "tax_rate",
          "type": "double precision",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "total_price": {
          "name": "total_price",
          "type": "double precision",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "sort_order": {
          "name": "sort_order",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "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": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.crm_quotation_topic_items": {
      "name": "crm_quotation_topic_items",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "topic_id": {
          "name": "topic_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "content": {
          "name": "content",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "sort_order": {
          "name": "sort_order",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "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": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.crm_quotation_topics": {
      "name": "crm_quotation_topics",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "quotation_id": {
          "name": "quotation_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "topic_type": {
          "name": "topic_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "sort_order": {
          "name": "sort_order",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "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": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.crm_quotations": {
      "name": "crm_quotations",
      "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
        },
        "enquiry_id": {
          "name": "enquiry_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "customer_id": {
          "name": "customer_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "contact_id": {
          "name": "contact_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "quotation_date": {
          "name": "quotation_date",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        },
        "valid_until": {
          "name": "valid_until",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "quotation_type": {
          "name": "quotation_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "project_name": {
          "name": "project_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "project_location": {
          "name": "project_location",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "attention": {
          "name": "attention",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "reference": {
          "name": "reference",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "revision": {
          "name": "revision",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "parent_quotation_id": {
          "name": "parent_quotation_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "revision_remark": {
          "name": "revision_remark",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "currency": {
          "name": "currency",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "exchange_rate": {
          "name": "exchange_rate",
          "type": "double precision",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "subtotal": {
          "name": "subtotal",
          "type": "double precision",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "discount": {
          "name": "discount",
          "type": "double precision",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "discount_type": {
          "name": "discount_type",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "tax_rate": {
          "name": "tax_rate",
          "type": "double precision",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "tax_amount": {
          "name": "tax_amount",
          "type": "double precision",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "total_amount": {
          "name": "total_amount",
          "type": "double precision",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "chance_percent": {
          "name": "chance_percent",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "is_hot_project": {
          "name": "is_hot_project",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "competitor": {
          "name": "competitor",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "salesman_id": {
          "name": "salesman_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_sent": {
          "name": "is_sent",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "sent_at": {
          "name": "sent_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "sent_via": {
          "name": "sent_via",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "approved_at": {
          "name": "approved_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "approved_pdf_url": {
          "name": "approved_pdf_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "approved_snapshot": {
          "name": "approved_snapshot",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "approved_template_version_id": {
          "name": "approved_template_version_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "accepted_at": {
          "name": "accepted_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "rejected_at": {
          "name": "rejected_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "rejection_reason": {
          "name": "rejection_reason",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": 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
        },
        "created_by": {
          "name": "created_by",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "updated_by": {
          "name": "updated_by",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {
        "crm_quotations_org_code_idx": {
          "name": "crm_quotations_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.document_sequences": {
      "name": "document_sequences",
      "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": true,
          "default": "''"
        },
        "document_type": {
          "name": "document_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "prefix": {
          "name": "prefix",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "period": {
          "name": "period",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "current_number": {
          "name": "current_number",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "padding_length": {
          "name": "padding_length",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 3
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": 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()"
        }
      },
      "indexes": {
        "document_sequences_org_doc_period_branch_idx": {
          "name": "document_sequences_org_doc_period_branch_idx",
          "columns": [
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "document_type",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "period",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "branch_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.memberships": {
      "name": "memberships",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "role": {
          "name": "role",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'user'"
        },
        "business_role": {
          "name": "business_role",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'viewer'"
        },
        "permissions": {
          "name": "permissions",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'"
        },
        "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()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.ms_options": {
      "name": "ms_options",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "category": {
          "name": "category",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "code": {
          "name": "code",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "label": {
          "name": "label",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "value": {
          "name": "value",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "parent_id": {
          "name": "parent_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "sort_order": {
          "name": "sort_order",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "deleted_at": {
          "name": "deleted_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "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()"
        }
      },
      "indexes": {
        "ms_options_org_category_code_idx": {
          "name": "ms_options_org_category_code_idx",
          "columns": [
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "category",
              "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.organizations": {
      "name": "organizations",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "slug": {
          "name": "slug",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "image_url": {
          "name": "image_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "plan": {
          "name": "plan",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'free'"
        },
        "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()"
        }
      },
      "indexes": {
        "organizations_slug_idx": {
          "name": "organizations_slug_idx",
          "columns": [
            {
              "expression": "slug",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.products": {
      "name": "products",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "integer",
          "primaryKey": true,
          "notNull": true,
          "identity": {
            "type": "always",
            "name": "products_id_seq",
            "schema": "public",
            "increment": "1",
            "startWith": "1",
            "minValue": "1",
            "maxValue": "2147483647",
            "cache": "1",
            "cycle": false
          }
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "category": {
          "name": "category",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "photo_url": {
          "name": "photo_url",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "price": {
          "name": "price",
          "type": "double precision",
          "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()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.tr_audit_logs": {
      "name": "tr_audit_logs",
      "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
        },
        "user_id": {
          "name": "user_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "entity_type": {
          "name": "entity_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "entity_id": {
          "name": "entity_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "action": {
          "name": "action",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "before_data": {
          "name": "before_data",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "after_data": {
          "name": "after_data",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "request_id": {
          "name": "request_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.users": {
      "name": "users",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "password_hash": {
          "name": "password_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "system_role": {
          "name": "system_role",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'user'"
        },
        "image": {
          "name": "image",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "active_organization_id": {
          "name": "active_organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "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()"
        }
      },
      "indexes": {
        "users_email_idx": {
          "name": "users_email_idx",
          "columns": [
            {
              "expression": "email",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    }
  },
  "enums": {},
  "schemas": {},
  "sequences": {},
  "roles": {},
  "policies": {},
  "views": {},
  "_meta": {
    "columns": {},
    "schemas": {},
    "tables": {}
  }
}