{
  "id": "2f815ae5-be6b-4dbd-baf9-35e092689b20",
  "prevId": "00000000-0000-0000-0000-000000000000",
  "version": "7",
  "dialect": "postgresql",
  "tables": {
    "public.activity_logs": {
      "name": "activity_logs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "action": {
          "name": "action",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "timestamp": {
          "name": "timestamp",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "ip_address": {
          "name": "ip_address",
          "type": "varchar(45)",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "activity_logs_team_id_teams_id_fk": {
          "name": "activity_logs_team_id_teams_id_fk",
          "tableFrom": "activity_logs",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "activity_logs_user_id_users_id_fk": {
          "name": "activity_logs_user_id_users_id_fk",
          "tableFrom": "activity_logs",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.ai_configs": {
      "name": "ai_configs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "provider": {
          "name": "provider",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": true
        },
        "model": {
          "name": "model",
          "type": "varchar(100)",
          "primaryKey": false,
          "notNull": true
        },
        "api_key": {
          "name": "api_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "system_prompt": {
          "name": "system_prompt",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "attachments": {
          "name": "attachments",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "temperature": {
          "name": "temperature",
          "type": "numeric(2, 1)",
          "primaryKey": false,
          "notNull": false,
          "default": "'0.7'"
        },
        "max_output_tokens": {
          "name": "max_output_tokens",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 1000
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "ai_configs_team_id_teams_id_fk": {
          "name": "ai_configs_team_id_teams_id_fk",
          "tableFrom": "ai_configs",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "team_ai_config_idx": {
          "name": "team_ai_config_idx",
          "nullsNotDistinct": false,
          "columns": [
            "team_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.ai_sessions": {
      "name": "ai_sessions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "chat_id": {
          "name": "chat_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": false,
          "default": "'active'"
        },
        "history": {
          "name": "history",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "ai_sessions_team_id_teams_id_fk": {
          "name": "ai_sessions_team_id_teams_id_fk",
          "tableFrom": "ai_sessions",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "ai_sessions_chat_id_chats_id_fk": {
          "name": "ai_sessions_chat_id_chats_id_fk",
          "tableFrom": "ai_sessions",
          "tableTo": "chats",
          "columnsFrom": [
            "chat_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.ai_tools": {
      "name": "ai_tools",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "varchar(30)",
          "primaryKey": false,
          "notNull": true,
          "default": "'media'"
        },
        "media_url": {
          "name": "media_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "media_type": {
          "name": "media_type",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": false
        },
        "caption": {
          "name": "caption",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "confirmation_message": {
          "name": "confirmation_message",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "action_data": {
          "name": "action_data",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "ai_tools_team_id_teams_id_fk": {
          "name": "ai_tools_team_id_teams_id_fk",
          "tableFrom": "ai_tools",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "team_tool_name_idx": {
          "name": "team_tool_name_idx",
          "nullsNotDistinct": false,
          "columns": [
            "team_id",
            "name"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.api_keys": {
      "name": "api_keys",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "varchar(100)",
          "primaryKey": false,
          "notNull": true
        },
        "key": {
          "name": "key",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true
        },
        "last_used_at": {
          "name": "last_used_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "api_key_team_id_idx": {
          "name": "api_key_team_id_idx",
          "columns": [
            {
              "expression": "team_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "api_key_value_idx": {
          "name": "api_key_value_idx",
          "columns": [
            {
              "expression": "key",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "api_keys_team_id_teams_id_fk": {
          "name": "api_keys_team_id_teams_id_fk",
          "tableFrom": "api_keys",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "api_keys_key_unique": {
          "name": "api_keys_key_unique",
          "nullsNotDistinct": false,
          "columns": [
            "key"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.automation_sessions": {
      "name": "automation_sessions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "automation_id": {
          "name": "automation_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "chat_id": {
          "name": "chat_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "contact_id": {
          "name": "contact_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "current_node_id": {
          "name": "current_node_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "variables": {
          "name": "variables",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "status": {
          "name": "status",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "automation_sessions_team_id_teams_id_fk": {
          "name": "automation_sessions_team_id_teams_id_fk",
          "tableFrom": "automation_sessions",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "automation_sessions_automation_id_automations_id_fk": {
          "name": "automation_sessions_automation_id_automations_id_fk",
          "tableFrom": "automation_sessions",
          "tableTo": "automations",
          "columnsFrom": [
            "automation_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "automation_sessions_chat_id_chats_id_fk": {
          "name": "automation_sessions_chat_id_chats_id_fk",
          "tableFrom": "automation_sessions",
          "tableTo": "chats",
          "columnsFrom": [
            "chat_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "automation_sessions_contact_id_contacts_id_fk": {
          "name": "automation_sessions_contact_id_contacts_id_fk",
          "tableFrom": "automation_sessions",
          "tableTo": "contacts",
          "columnsFrom": [
            "contact_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.automations": {
      "name": "automations",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true
        },
        "instance_id": {
          "name": "instance_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "trigger_keyword": {
          "name": "trigger_keyword",
          "type": "varchar(100)",
          "primaryKey": false,
          "notNull": false
        },
        "nodes": {
          "name": "nodes",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'[]'::jsonb"
        },
        "edges": {
          "name": "edges",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'[]'::jsonb"
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "automations_team_id_teams_id_fk": {
          "name": "automations_team_id_teams_id_fk",
          "tableFrom": "automations",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "automations_instance_id_evolution_instances_id_fk": {
          "name": "automations_instance_id_evolution_instances_id_fk",
          "tableFrom": "automations",
          "tableTo": "evolution_instances",
          "columnsFrom": [
            "instance_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.branding": {
      "name": "branding",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "varchar(100)",
          "primaryKey": false,
          "notNull": true,
          "default": "'WhatsSaaS'"
        },
        "logo_url": {
          "name": "logo_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "favicon_url": {
          "name": "favicon_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.call_credit_transactions": {
      "name": "call_credit_transactions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": true
        },
        "amount": {
          "name": "amount",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "call_log_id": {
          "name": "call_log_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "stripe_payment_intent_id": {
          "name": "stripe_payment_intent_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "call_credit_tx_team_id_idx": {
          "name": "call_credit_tx_team_id_idx",
          "columns": [
            {
              "expression": "team_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "call_credit_transactions_team_id_teams_id_fk": {
          "name": "call_credit_transactions_team_id_teams_id_fk",
          "tableFrom": "call_credit_transactions",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "call_credit_transactions_call_log_id_call_logs_id_fk": {
          "name": "call_credit_transactions_call_log_id_call_logs_id_fk",
          "tableFrom": "call_credit_transactions",
          "tableTo": "call_logs",
          "columnsFrom": [
            "call_log_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.call_credits": {
      "name": "call_credits",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "balance": {
          "name": "balance",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "call_credits_team_id_teams_id_fk": {
          "name": "call_credits_team_id_teams_id_fk",
          "tableFrom": "call_credits",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "call_credits_team_id_idx": {
          "name": "call_credits_team_id_idx",
          "nullsNotDistinct": false,
          "columns": [
            "team_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.call_logs": {
      "name": "call_logs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "chat_id": {
          "name": "chat_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "user_id": {
          "name": "user_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "twilio_call_sid": {
          "name": "twilio_call_sid",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "direction": {
          "name": "direction",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": true
        },
        "from_number": {
          "name": "from_number",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": true
        },
        "to_number": {
          "name": "to_number",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "varchar(30)",
          "primaryKey": false,
          "notNull": true,
          "default": "'initiated'"
        },
        "duration": {
          "name": "duration",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "recording_url": {
          "name": "recording_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "recording_sid": {
          "name": "recording_sid",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "credits_used": {
          "name": "credits_used",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "started_at": {
          "name": "started_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "ended_at": {
          "name": "ended_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "call_logs_team_id_idx": {
          "name": "call_logs_team_id_idx",
          "columns": [
            {
              "expression": "team_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "call_logs_chat_id_idx": {
          "name": "call_logs_chat_id_idx",
          "columns": [
            {
              "expression": "chat_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "call_logs_twilio_call_sid_idx": {
          "name": "call_logs_twilio_call_sid_idx",
          "columns": [
            {
              "expression": "twilio_call_sid",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "call_logs_team_id_teams_id_fk": {
          "name": "call_logs_team_id_teams_id_fk",
          "tableFrom": "call_logs",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "call_logs_chat_id_chats_id_fk": {
          "name": "call_logs_chat_id_chats_id_fk",
          "tableFrom": "call_logs",
          "tableTo": "chats",
          "columnsFrom": [
            "chat_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "call_logs_user_id_users_id_fk": {
          "name": "call_logs_user_id_users_id_fk",
          "tableFrom": "call_logs",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "call_logs_twilio_call_sid_unique": {
          "name": "call_logs_twilio_call_sid_unique",
          "nullsNotDistinct": false,
          "columns": [
            "twilio_call_sid"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.campaign_leads": {
      "name": "campaign_leads",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "campaign_id": {
          "name": "campaign_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "phone": {
          "name": "phone",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": true
        },
        "variables": {
          "name": "variables",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": false,
          "default": "'PENDING'"
        },
        "error": {
          "name": "error",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "campaign_leads_campaign_id_campaigns_id_fk": {
          "name": "campaign_leads_campaign_id_campaigns_id_fk",
          "tableFrom": "campaign_leads",
          "tableTo": "campaigns",
          "columnsFrom": [
            "campaign_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.campaigns": {
      "name": "campaigns",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "instance_id": {
          "name": "instance_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": true,
          "default": "'DRAFT'"
        },
        "scheduled_at": {
          "name": "scheduled_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "template_id": {
          "name": "template_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "total_leads": {
          "name": "total_leads",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 0
        },
        "sent_count": {
          "name": "sent_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 0
        },
        "failed_count": {
          "name": "failed_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 0
        },
        "create_contacts": {
          "name": "create_contacts",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "campaigns_team_id_teams_id_fk": {
          "name": "campaigns_team_id_teams_id_fk",
          "tableFrom": "campaigns",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "campaigns_instance_id_evolution_instances_id_fk": {
          "name": "campaigns_instance_id_evolution_instances_id_fk",
          "tableFrom": "campaigns",
          "tableTo": "evolution_instances",
          "columnsFrom": [
            "instance_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "campaigns_template_id_waba_templates_id_fk": {
          "name": "campaigns_template_id_waba_templates_id_fk",
          "tableFrom": "campaigns",
          "tableTo": "waba_templates",
          "columnsFrom": [
            "template_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.channel_configs": {
      "name": "channel_configs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "channel": {
          "name": "channel",
          "type": "varchar(30)",
          "primaryKey": false,
          "notNull": true
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "api_url": {
          "name": "api_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "api_key": {
          "name": "api_key",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "webhook_url": {
          "name": "webhook_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "webhook_token": {
          "name": "webhook_token",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "meta_app_id": {
          "name": "meta_app_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "meta_app_secret": {
          "name": "meta_app_secret",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "meta_config_id": {
          "name": "meta_config_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "meta_webhook_token": {
          "name": "meta_webhook_token",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "channel_configs_channel_unique": {
          "name": "channel_configs_channel_unique",
          "nullsNotDistinct": false,
          "columns": [
            "channel"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.chat_theme": {
      "name": "chat_theme",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "background_type": {
          "name": "background_type",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": true,
          "default": "'solid'"
        },
        "background_color": {
          "name": "background_color",
          "type": "varchar(30)",
          "primaryKey": false,
          "notNull": true,
          "default": "'#F4F4F5'"
        },
        "background_image_url": {
          "name": "background_image_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "user_bubble_color": {
          "name": "user_bubble_color",
          "type": "varchar(30)",
          "primaryKey": false,
          "notNull": true,
          "default": "'#E2EDE4'"
        },
        "contact_bubble_color": {
          "name": "contact_bubble_color",
          "type": "varchar(30)",
          "primaryKey": false,
          "notNull": true,
          "default": "'#FFFFFF'"
        },
        "dark_background_color": {
          "name": "dark_background_color",
          "type": "varchar(30)",
          "primaryKey": false,
          "notNull": true,
          "default": "'#27272A'"
        },
        "dark_user_bubble_color": {
          "name": "dark_user_bubble_color",
          "type": "varchar(30)",
          "primaryKey": false,
          "notNull": true,
          "default": "'#2A352E'"
        },
        "dark_contact_bubble_color": {
          "name": "dark_contact_bubble_color",
          "type": "varchar(30)",
          "primaryKey": false,
          "notNull": true,
          "default": "'#18181B'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.chats": {
      "name": "chats",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "instance_id": {
          "name": "instance_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "remote_jid": {
          "name": "remote_jid",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "push_name": {
          "name": "push_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "profile_pic_url": {
          "name": "profile_pic_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "last_message_text": {
          "name": "last_message_text",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "last_message_timestamp": {
          "name": "last_message_timestamp",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "last_customer_interaction": {
          "name": "last_customer_interaction",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "unread_count": {
          "name": "unread_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 0
        },
        "last_message_status": {
          "name": "last_message_status",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": false
        },
        "last_message_from_me": {
          "name": "last_message_from_me",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "chats_team_id_teams_id_fk": {
          "name": "chats_team_id_teams_id_fk",
          "tableFrom": "chats",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "chats_instance_id_evolution_instances_id_fk": {
          "name": "chats_instance_id_evolution_instances_id_fk",
          "tableFrom": "chats",
          "tableTo": "evolution_instances",
          "columnsFrom": [
            "instance_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "team_chat_instance_idx": {
          "name": "team_chat_instance_idx",
          "nullsNotDistinct": false,
          "columns": [
            "team_id",
            "remote_jid",
            "instance_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.contact_tags": {
      "name": "contact_tags",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "contact_id": {
          "name": "contact_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "tag_id": {
          "name": "tag_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "contact_tags_contact_id_contacts_id_fk": {
          "name": "contact_tags_contact_id_contacts_id_fk",
          "tableFrom": "contact_tags",
          "tableTo": "contacts",
          "columnsFrom": [
            "contact_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "contact_tags_tag_id_tags_id_fk": {
          "name": "contact_tags_tag_id_tags_id_fk",
          "tableFrom": "contact_tags",
          "tableTo": "tags",
          "columnsFrom": [
            "tag_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "contact_tag_idx": {
          "name": "contact_tag_idx",
          "nullsNotDistinct": false,
          "columns": [
            "contact_id",
            "tag_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.contacts": {
      "name": "contacts",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "chat_id": {
          "name": "chat_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "assigned_user_id": {
          "name": "assigned_user_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "assigned_department_id": {
          "name": "assigned_department_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "funnel_stage_id": {
          "name": "funnel_stage_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "custom_data": {
          "name": "custom_data",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "show_time_in_stage": {
          "name": "show_time_in_stage",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "contact_team_id_idx": {
          "name": "contact_team_id_idx",
          "columns": [
            {
              "expression": "team_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "contact_chat_id_idx": {
          "name": "contact_chat_id_idx",
          "columns": [
            {
              "expression": "chat_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "contacts_team_id_teams_id_fk": {
          "name": "contacts_team_id_teams_id_fk",
          "tableFrom": "contacts",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "contacts_chat_id_chats_id_fk": {
          "name": "contacts_chat_id_chats_id_fk",
          "tableFrom": "contacts",
          "tableTo": "chats",
          "columnsFrom": [
            "chat_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "contacts_assigned_user_id_users_id_fk": {
          "name": "contacts_assigned_user_id_users_id_fk",
          "tableFrom": "contacts",
          "tableTo": "users",
          "columnsFrom": [
            "assigned_user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "contacts_assigned_department_id_departments_id_fk": {
          "name": "contacts_assigned_department_id_departments_id_fk",
          "tableFrom": "contacts",
          "tableTo": "departments",
          "columnsFrom": [
            "assigned_department_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "contacts_funnel_stage_id_funnel_stages_id_fk": {
          "name": "contacts_funnel_stage_id_funnel_stages_id_fk",
          "tableFrom": "contacts",
          "tableTo": "funnel_stages",
          "columnsFrom": [
            "funnel_stage_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "contacts_chat_id_unique": {
          "name": "contacts_chat_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "chat_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.custom_fields": {
      "name": "custom_fields",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "varchar(100)",
          "primaryKey": false,
          "notNull": true
        },
        "key": {
          "name": "key",
          "type": "varchar(100)",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": true,
          "default": "'text'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "custom_fields_team_id_teams_id_fk": {
          "name": "custom_fields_team_id_teams_id_fk",
          "tableFrom": "custom_fields",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "team_field_key_idx": {
          "name": "team_field_key_idx",
          "nullsNotDistinct": false,
          "columns": [
            "team_id",
            "key"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.department_members": {
      "name": "department_members",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "department_id": {
          "name": "department_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "department_members_department_id_departments_id_fk": {
          "name": "department_members_department_id_departments_id_fk",
          "tableFrom": "department_members",
          "tableTo": "departments",
          "columnsFrom": [
            "department_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "department_members_user_id_users_id_fk": {
          "name": "department_members_user_id_users_id_fk",
          "tableFrom": "department_members",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "dept_user_idx": {
          "name": "dept_user_idx",
          "nullsNotDistinct": false,
          "columns": [
            "department_id",
            "user_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.departments": {
      "name": "departments",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "varchar(100)",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "departments_team_id_teams_id_fk": {
          "name": "departments_team_id_teams_id_fk",
          "tableFrom": "departments",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "team_department_name_idx": {
          "name": "team_department_name_idx",
          "nullsNotDistinct": false,
          "columns": [
            "team_id",
            "name"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.evolution_instances": {
      "name": "evolution_instances",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "instance_name": {
          "name": "instance_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "display_name": {
          "name": "display_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "instance_number": {
          "name": "instance_number",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "evolution_instance_id": {
          "name": "evolution_instance_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "meta_token": {
          "name": "meta_token",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "access_token": {
          "name": "access_token",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "integration": {
          "name": "integration",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": true,
          "default": "'WHATSAPP-BAILEYS'"
        },
        "meta_business_id": {
          "name": "meta_business_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "meta_phone_number_id": {
          "name": "meta_phone_number_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "meta_waba_id": {
          "name": "meta_waba_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "meta_app_id": {
          "name": "meta_app_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "instance_team_id_idx": {
          "name": "instance_team_id_idx",
          "columns": [
            {
              "expression": "team_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "evolution_instances_team_id_teams_id_fk": {
          "name": "evolution_instances_team_id_teams_id_fk",
          "tableFrom": "evolution_instances",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "evolution_instances_evolution_instance_id_unique": {
          "name": "evolution_instances_evolution_instance_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "evolution_instance_id"
          ]
        },
        "team_instance_name_idx": {
          "name": "team_instance_name_idx",
          "nullsNotDistinct": false,
          "columns": [
            "team_id",
            "instance_name"
          ]
        },
        "team_instance_id_idx": {
          "name": "team_instance_id_idx",
          "nullsNotDistinct": false,
          "columns": [
            "team_id",
            "evolution_instance_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.execution_logs": {
      "name": "execution_logs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "chat_id": {
          "name": "chat_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "message_id": {
          "name": "message_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "source": {
          "name": "source",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": true
        },
        "event_type": {
          "name": "event_type",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": true
        },
        "automation_id": {
          "name": "automation_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "automation_session_id": {
          "name": "automation_session_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "node_id": {
          "name": "node_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "node_type": {
          "name": "node_type",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": false
        },
        "input_data": {
          "name": "input_data",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "output_data": {
          "name": "output_data",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "duration_ms": {
          "name": "duration_ms",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": true,
          "default": "'success'"
        },
        "error_message": {
          "name": "error_message",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "idx_exec_logs_chat_created": {
          "name": "idx_exec_logs_chat_created",
          "columns": [
            {
              "expression": "chat_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "idx_exec_logs_message": {
          "name": "idx_exec_logs_message",
          "columns": [
            {
              "expression": "message_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "idx_exec_logs_team_created": {
          "name": "idx_exec_logs_team_created",
          "columns": [
            {
              "expression": "team_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "execution_logs_team_id_teams_id_fk": {
          "name": "execution_logs_team_id_teams_id_fk",
          "tableFrom": "execution_logs",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "execution_logs_chat_id_chats_id_fk": {
          "name": "execution_logs_chat_id_chats_id_fk",
          "tableFrom": "execution_logs",
          "tableTo": "chats",
          "columnsFrom": [
            "chat_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.funnel_stages": {
      "name": "funnel_stages",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "varchar(100)",
          "primaryKey": false,
          "notNull": true
        },
        "emoji": {
          "name": "emoji",
          "type": "varchar(10)",
          "primaryKey": false,
          "notNull": false,
          "default": "'📁'"
        },
        "order": {
          "name": "order",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "funnel_stages_team_id_teams_id_fk": {
          "name": "funnel_stages_team_id_teams_id_fk",
          "tableFrom": "funnel_stages",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.invitations": {
      "name": "invitations",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "email": {
          "name": "email",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true
        },
        "role": {
          "name": "role",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": true
        },
        "invited_by": {
          "name": "invited_by",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "invited_at": {
          "name": "invited_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "status": {
          "name": "status",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "invitations_team_id_teams_id_fk": {
          "name": "invitations_team_id_teams_id_fk",
          "tableFrom": "invitations",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "invitations_invited_by_users_id_fk": {
          "name": "invitations_invited_by_users_id_fk",
          "tableFrom": "invitations",
          "tableTo": "users",
          "columnsFrom": [
            "invited_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.message_reactions": {
      "name": "message_reactions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "message_id": {
          "name": "message_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "chat_id": {
          "name": "chat_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "emoji": {
          "name": "emoji",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "from_me": {
          "name": "from_me",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "remote_jid": {
          "name": "remote_jid",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "participant_name": {
          "name": "participant_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "timestamp": {
          "name": "timestamp",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "reaction_message_id_idx": {
          "name": "reaction_message_id_idx",
          "columns": [
            {
              "expression": "message_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "message_reactions_message_id_messages_id_fk": {
          "name": "message_reactions_message_id_messages_id_fk",
          "tableFrom": "message_reactions",
          "tableTo": "messages",
          "columnsFrom": [
            "message_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "message_reactions_chat_id_chats_id_fk": {
          "name": "message_reactions_chat_id_chats_id_fk",
          "tableFrom": "message_reactions",
          "tableTo": "chats",
          "columnsFrom": [
            "chat_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "unique_reaction_per_user_idx": {
          "name": "unique_reaction_per_user_idx",
          "nullsNotDistinct": false,
          "columns": [
            "message_id",
            "remote_jid",
            "from_me"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.messages": {
      "name": "messages",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "chat_id": {
          "name": "chat_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "from_me": {
          "name": "from_me",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true
        },
        "message_type": {
          "name": "message_type",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "text": {
          "name": "text",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "media_url": {
          "name": "media_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "media_mimetype": {
          "name": "media_mimetype",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "media_caption": {
          "name": "media_caption",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "media_file_length": {
          "name": "media_file_length",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "media_seconds": {
          "name": "media_seconds",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "media_is_ptt": {
          "name": "media_is_ptt",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false
        },
        "contact_name": {
          "name": "contact_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "contact_vcard": {
          "name": "contact_vcard",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "location_latitude": {
          "name": "location_latitude",
          "type": "numeric(10, 7)",
          "primaryKey": false,
          "notNull": false
        },
        "location_longitude": {
          "name": "location_longitude",
          "type": "numeric(10, 7)",
          "primaryKey": false,
          "notNull": false
        },
        "location_name": {
          "name": "location_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "location_address": {
          "name": "location_address",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": false,
          "default": "'sent'"
        },
        "is_ai": {
          "name": "is_ai",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "is_automation": {
          "name": "is_automation",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "quoted_message_id": {
          "name": "quoted_message_id",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false
        },
        "quoted_message_text": {
          "name": "quoted_message_text",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_internal": {
          "name": "is_internal",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "participant": {
          "name": "participant",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "participant_name": {
          "name": "participant_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "error_message": {
          "name": "error_message",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "timestamp": {
          "name": "timestamp",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {},
      "foreignKeys": {
        "messages_chat_id_chats_id_fk": {
          "name": "messages_chat_id_chats_id_fk",
          "tableFrom": "messages",
          "tableTo": "chats",
          "columnsFrom": [
            "chat_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.offline_payment_requests": {
      "name": "offline_payment_requests",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "plan_id": {
          "name": "plan_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "amount": {
          "name": "amount",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "currency": {
          "name": "currency",
          "type": "varchar(3)",
          "primaryKey": false,
          "notNull": true,
          "default": "'usd'"
        },
        "status": {
          "name": "status",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "offline_payment_requests_team_id_teams_id_fk": {
          "name": "offline_payment_requests_team_id_teams_id_fk",
          "tableFrom": "offline_payment_requests",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.password_reset_tokens": {
      "name": "password_reset_tokens",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "token": {
          "name": "token",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true
        },
        "used_at": {
          "name": "used_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "password_reset_tokens_user_id_users_id_fk": {
          "name": "password_reset_tokens_user_id_users_id_fk",
          "tableFrom": "password_reset_tokens",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "password_reset_tokens_token_unique": {
          "name": "password_reset_tokens_token_unique",
          "nullsNotDistinct": false,
          "columns": [
            "token"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.payment_gateways": {
      "name": "payment_gateways",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "gateway": {
          "name": "gateway",
          "type": "varchar(30)",
          "primaryKey": false,
          "notNull": true
        },
        "display_name": {
          "name": "display_name",
          "type": "varchar(100)",
          "primaryKey": false,
          "notNull": true
        },
        "public_key": {
          "name": "public_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "secret_key": {
          "name": "secret_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "webhook_secret": {
          "name": "webhook_secret",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.plans": {
      "name": "plans",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "varchar(100)",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "gateway_id": {
          "name": "gateway_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "gateway_product_id": {
          "name": "gateway_product_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "gateway_price_id": {
          "name": "gateway_price_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "stripe_product_id": {
          "name": "stripe_product_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "stripe_price_id": {
          "name": "stripe_price_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "amount": {
          "name": "amount",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "currency": {
          "name": "currency",
          "type": "varchar(3)",
          "primaryKey": false,
          "notNull": true,
          "default": "'usd'"
        },
        "interval": {
          "name": "interval",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": true,
          "default": "'month'"
        },
        "trial_days": {
          "name": "trial_days",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "max_users": {
          "name": "max_users",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "max_contacts": {
          "name": "max_contacts",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1000
        },
        "max_instances": {
          "name": "max_instances",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "is_ai_enabled": {
          "name": "is_ai_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "is_flow_builder_enabled": {
          "name": "is_flow_builder_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "is_campaigns_enabled": {
          "name": "is_campaigns_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "is_templates_enabled": {
          "name": "is_templates_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "is_voice_calls_enabled": {
          "name": "is_voice_calls_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "plans_gateway_id_payment_gateways_id_fk": {
          "name": "plans_gateway_id_payment_gateways_id_fk",
          "tableFrom": "plans",
          "tableTo": "payment_gateways",
          "columnsFrom": [
            "gateway_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.push_tokens": {
      "name": "push_tokens",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "token": {
          "name": "token",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "device_id": {
          "name": "device_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "push_token_value_idx": {
          "name": "push_token_value_idx",
          "columns": [
            {
              "expression": "token",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "push_tokens_user_id_users_id_fk": {
          "name": "push_tokens_user_id_users_id_fk",
          "tableFrom": "push_tokens",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "user_push_token_idx": {
          "name": "user_push_token_idx",
          "nullsNotDistinct": false,
          "columns": [
            "user_id",
            "token"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.quick_replies": {
      "name": "quick_replies",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "shortcut": {
          "name": "shortcut",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": true
        },
        "content": {
          "name": "content",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "quick_replies_team_id_teams_id_fk": {
          "name": "quick_replies_team_id_teams_id_fk",
          "tableFrom": "quick_replies",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "team_shortcut_idx": {
          "name": "team_shortcut_idx",
          "nullsNotDistinct": false,
          "columns": [
            "team_id",
            "shortcut"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.tags": {
      "name": "tags",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "varchar(100)",
          "primaryKey": false,
          "notNull": true
        },
        "color": {
          "name": "color",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": false,
          "default": "'gray'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "tags_team_id_teams_id_fk": {
          "name": "tags_team_id_teams_id_fk",
          "tableFrom": "tags",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "team_tag_name_idx": {
          "name": "team_tag_name_idx",
          "nullsNotDistinct": false,
          "columns": [
            "team_id",
            "name"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.team_members": {
      "name": "team_members",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "role": {
          "name": "role",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": true
        },
        "permissions": {
          "name": "permissions",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "joined_at": {
          "name": "joined_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "team_members_user_id_users_id_fk": {
          "name": "team_members_user_id_users_id_fk",
          "tableFrom": "team_members",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "team_members_team_id_teams_id_fk": {
          "name": "team_members_team_id_teams_id_fk",
          "tableFrom": "team_members",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.team_phone_numbers": {
      "name": "team_phone_numbers",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "phone_number": {
          "name": "phone_number",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": true
        },
        "twilio_phone_sid": {
          "name": "twilio_phone_sid",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "friendly_name": {
          "name": "friendly_name",
          "type": "varchar(100)",
          "primaryKey": false,
          "notNull": false
        },
        "stripe_subscription_id": {
          "name": "stripe_subscription_id",
          "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",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "team_phone_numbers_team_id_teams_id_fk": {
          "name": "team_phone_numbers_team_id_teams_id_fk",
          "tableFrom": "team_phone_numbers",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.teams": {
      "name": "teams",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "varchar(100)",
          "primaryKey": false,
          "notNull": true
        },
        "plan_id": {
          "name": "plan_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "stripe_customer_id": {
          "name": "stripe_customer_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "stripe_subscription_id": {
          "name": "stripe_subscription_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "stripe_product_id": {
          "name": "stripe_product_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "gateway_type": {
          "name": "gateway_type",
          "type": "varchar(30)",
          "primaryKey": false,
          "notNull": false
        },
        "gateway_customer_id": {
          "name": "gateway_customer_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "gateway_subscription_id": {
          "name": "gateway_subscription_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "plan_name": {
          "name": "plan_name",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": false
        },
        "subscription_status": {
          "name": "subscription_status",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": false
        },
        "is_canceled": {
          "name": "is_canceled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "trial_ends_at": {
          "name": "trial_ends_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "teams_plan_id_plans_id_fk": {
          "name": "teams_plan_id_plans_id_fk",
          "tableFrom": "teams",
          "tableTo": "plans",
          "columnsFrom": [
            "plan_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "teams_stripe_customer_id_unique": {
          "name": "teams_stripe_customer_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "stripe_customer_id"
          ]
        },
        "teams_stripe_subscription_id_unique": {
          "name": "teams_stripe_subscription_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "stripe_subscription_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.twilio_configs": {
      "name": "twilio_configs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "account_sid": {
          "name": "account_sid",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "auth_token": {
          "name": "auth_token",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "api_key_sid": {
          "name": "api_key_sid",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "api_key_secret": {
          "name": "api_key_secret",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "twiml_app_sid": {
          "name": "twiml_app_sid",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "credit_price_per_pack": {
          "name": "credit_price_per_pack",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1000
        },
        "credits_per_pack": {
          "name": "credits_per_pack",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 50
        },
        "price_per_number": {
          "name": "price_per_number",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1000
        },
        "payment_gateway_id": {
          "name": "payment_gateway_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "currency": {
          "name": "currency",
          "type": "varchar(3)",
          "primaryKey": false,
          "notNull": false,
          "default": "'usd'"
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "twilio_configs_payment_gateway_id_payment_gateways_id_fk": {
          "name": "twilio_configs_payment_gateway_id_payment_gateways_id_fk",
          "tableFrom": "twilio_configs",
          "tableTo": "payment_gateways",
          "columnsFrom": [
            "payment_gateway_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.users": {
      "name": "users",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "varchar(100)",
          "primaryKey": false,
          "notNull": false
        },
        "email": {
          "name": "email",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true
        },
        "password_hash": {
          "name": "password_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "role": {
          "name": "role",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": true,
          "default": "'member'"
        },
        "enable_signature": {
          "name": "enable_signature",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "deleted_at": {
          "name": "deleted_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "users_email_unique": {
          "name": "users_email_unique",
          "nullsNotDistinct": false,
          "columns": [
            "email"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.waba_templates": {
      "name": "waba_templates",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "instance_id": {
          "name": "instance_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "meta_id": {
          "name": "meta_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "name": {
          "name": "name",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true
        },
        "language": {
          "name": "language",
          "type": "varchar(10)",
          "primaryKey": false,
          "notNull": true
        },
        "category": {
          "name": "category",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": true,
          "default": "'PENDING'"
        },
        "components": {
          "name": "components",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "waba_templates_team_id_teams_id_fk": {
          "name": "waba_templates_team_id_teams_id_fk",
          "tableFrom": "waba_templates",
          "tableTo": "teams",
          "columnsFrom": [
            "team_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "waba_templates_instance_id_evolution_instances_id_fk": {
          "name": "waba_templates_instance_id_evolution_instances_id_fk",
          "tableFrom": "waba_templates",
          "tableTo": "evolution_instances",
          "columnsFrom": [
            "instance_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "waba_template_name_lang_idx": {
          "name": "waba_template_name_lang_idx",
          "nullsNotDistinct": false,
          "columns": [
            "instance_id",
            "name",
            "language"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.webhook_events": {
      "name": "webhook_events",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "team_id": {
          "name": "team_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "instance_name": {
          "name": "instance_name",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true
        },
        "event": {
          "name": "event",
          "type": "varchar(100)",
          "primaryKey": false,
          "notNull": true
        },
        "message_id": {
          "name": "message_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "remote_jid": {
          "name": "remote_jid",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": true,
          "default": "'received'"
        },
        "error": {
          "name": "error",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "processed_at": {
          "name": "processed_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "webhook_events_team_id_idx": {
          "name": "webhook_events_team_id_idx",
          "columns": [
            {
              "expression": "team_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "webhook_events_status_idx": {
          "name": "webhook_events_status_idx",
          "columns": [
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "webhook_events_created_at_idx": {
          "name": "webhook_events_created_at_idx",
          "columns": [
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    }
  },
  "enums": {},
  "schemas": {},
  "sequences": {},
  "roles": {},
  "policies": {},
  "views": {},
  "_meta": {
    "columns": {},
    "schemas": {},
    "tables": {}
  }
}