{
  "id": "9c1a8110-33ce-4dc8-89b8-0f69203dfec1",
  "prevId": "be5ae51f-ace4-46ff-9bc1-f2c50099b701",
  "version": "7",
  "dialect": "postgresql",
  "tables": {
    "public.activities": {
      "name": "activities",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "contact_id": {
          "name": "contact_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "deal_id": {
          "name": "deal_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "due_at": {
          "name": "due_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "completed_at": {
          "name": "completed_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "outcome": {
          "name": "outcome",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "duration_sec": {
          "name": "duration_sec",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "recording_url": {
          "name": "recording_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "calendar_event_id": {
          "name": "calendar_event_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "reminder_sent_at": {
          "name": "reminder_sent_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "activities_contact_idx": {
          "name": "activities_contact_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "contact_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "activities_due_idx": {
          "name": "activities_due_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "due_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "activities_workspace_id_workspaces_id_fk": {
          "name": "activities_workspace_id_workspaces_id_fk",
          "tableFrom": "activities",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "activities_contact_id_contacts_id_fk": {
          "name": "activities_contact_id_contacts_id_fk",
          "tableFrom": "activities",
          "tableTo": "contacts",
          "columnsFrom": [
            "contact_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.ad_accounts": {
      "name": "ad_accounts",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "integration_id": {
          "name": "integration_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "provider": {
          "name": "provider",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "external_id": {
          "name": "external_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "currency": {
          "name": "currency",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "timezone": {
          "name": "timezone",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "monthly_budget": {
          "name": "monthly_budget",
          "type": "bigint",
          "primaryKey": false,
          "notNull": false
        },
        "pixel_id": {
          "name": "pixel_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "ad_accounts_workspace_id_workspaces_id_fk": {
          "name": "ad_accounts_workspace_id_workspaces_id_fk",
          "tableFrom": "ad_accounts",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.ad_metrics_daily": {
      "name": "ad_metrics_daily",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "date": {
          "name": "date",
          "type": "date",
          "primaryKey": false,
          "notNull": true
        },
        "ad_id": {
          "name": "ad_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "spend": {
          "name": "spend",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "impressions": {
          "name": "impressions",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "clicks": {
          "name": "clicks",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "leads": {
          "name": "leads",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "conversions": {
          "name": "conversions",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        }
      },
      "indexes": {
        "amd_uq": {
          "name": "amd_uq",
          "columns": [
            {
              "expression": "ad_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "date",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "amd_ws_date_idx": {
          "name": "amd_ws_date_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "date",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "ad_metrics_daily_workspace_id_workspaces_id_fk": {
          "name": "ad_metrics_daily_workspace_id_workspaces_id_fk",
          "tableFrom": "ad_metrics_daily",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "ad_metrics_daily_ad_id_ads_id_fk": {
          "name": "ad_metrics_daily_ad_id_ads_id_fk",
          "tableFrom": "ad_metrics_daily",
          "tableTo": "ads",
          "columnsFrom": [
            "ad_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.ad_sets": {
      "name": "ad_sets",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "campaign_id": {
          "name": "campaign_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "provider": {
          "name": "provider",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "external_id": {
          "name": "external_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "budget": {
          "name": "budget",
          "type": "bigint",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "ad_sets_workspace_id_workspaces_id_fk": {
          "name": "ad_sets_workspace_id_workspaces_id_fk",
          "tableFrom": "ad_sets",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "ad_sets_campaign_id_campaigns_id_fk": {
          "name": "ad_sets_campaign_id_campaigns_id_fk",
          "tableFrom": "ad_sets",
          "tableTo": "campaigns",
          "columnsFrom": [
            "campaign_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.ads": {
      "name": "ads",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "ad_set_id": {
          "name": "ad_set_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "provider": {
          "name": "provider",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "external_id": {
          "name": "external_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "ads_workspace_id_workspaces_id_fk": {
          "name": "ads_workspace_id_workspaces_id_fk",
          "tableFrom": "ads",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "ads_ad_set_id_ad_sets_id_fk": {
          "name": "ads_ad_set_id_ad_sets_id_fk",
          "tableFrom": "ads",
          "tableTo": "ad_sets",
          "columnsFrom": [
            "ad_set_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.agencies": {
      "name": "agencies",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "branding": {
          "name": "branding",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "plan": {
          "name": "plan",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'agency'"
        },
        "billing_customer_id": {
          "name": "billing_customer_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.ai_actions": {
      "name": "ai_actions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "agent": {
          "name": "agent",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "proposed_action": {
          "name": "proposed_action",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "reasoning": {
          "name": "reasoning",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "expected_impact": {
          "name": "expected_impact",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'proposed'"
        },
        "approver_id": {
          "name": "approver_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "result": {
          "name": "result",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "ai_actions_workspace_id_workspaces_id_fk": {
          "name": "ai_actions_workspace_id_workspaces_id_fk",
          "tableFrom": "ai_actions",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.ai_auto_approve_rules": {
      "name": "ai_auto_approve_rules",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "max_budget_change_pct": {
          "name": "max_budget_change_pct",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "max_daily_spend": {
          "name": "max_daily_spend",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "active": {
          "name": "active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "ai_auto_approve_rules_workspace_id_workspaces_id_fk": {
          "name": "ai_auto_approve_rules_workspace_id_workspaces_id_fk",
          "tableFrom": "ai_auto_approve_rules",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.ai_logs": {
      "name": "ai_logs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "feature": {
          "name": "feature",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "model": {
          "name": "model",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "prompt_hash": {
          "name": "prompt_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "prompt": {
          "name": "prompt",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "response": {
          "name": "response",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "tool_calls": {
          "name": "tool_calls",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "input_tokens": {
          "name": "input_tokens",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "output_tokens": {
          "name": "output_tokens",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "credits": {
          "name": "credits",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "cached": {
          "name": "cached",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "ailog_hash_idx": {
          "name": "ailog_hash_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "prompt_hash",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "ai_logs_workspace_id_workspaces_id_fk": {
          "name": "ai_logs_workspace_id_workspaces_id_fk",
          "tableFrom": "ai_logs",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.anomalies": {
      "name": "anomalies",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "metric": {
          "name": "metric",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "object_type": {
          "name": "object_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "object_id": {
          "name": "object_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "object_name": {
          "name": "object_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "baseline": {
          "name": "baseline",
          "type": "real",
          "primaryKey": false,
          "notNull": true
        },
        "current": {
          "name": "current",
          "type": "real",
          "primaryKey": false,
          "notNull": true
        },
        "change_pct": {
          "name": "change_pct",
          "type": "real",
          "primaryKey": false,
          "notNull": true
        },
        "message": {
          "name": "message",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "acknowledged_at": {
          "name": "acknowledged_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "anomalies_workspace_id_workspaces_id_fk": {
          "name": "anomalies_workspace_id_workspaces_id_fk",
          "tableFrom": "anomalies",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.api_keys": {
      "name": "api_keys",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "prefix": {
          "name": "prefix",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "hashed_key": {
          "name": "hashed_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "scopes": {
          "name": "scopes",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true
        },
        "last_used_at": {
          "name": "last_used_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "revoked_at": {
          "name": "revoked_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "api_keys_hash_uq": {
          "name": "api_keys_hash_uq",
          "columns": [
            {
              "expression": "hashed_key",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "api_keys_workspace_id_workspaces_id_fk": {
          "name": "api_keys_workspace_id_workspaces_id_fk",
          "tableFrom": "api_keys",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.assets": {
      "name": "assets",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "url": {
          "name": "url",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "folder": {
          "name": "folder",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'General'"
        },
        "tags": {
          "name": "tags",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::text[]"
        },
        "brand_kit_id": {
          "name": "brand_kit_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "size_bytes": {
          "name": "size_bytes",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "assets_workspace_id_workspaces_id_fk": {
          "name": "assets_workspace_id_workspaces_id_fk",
          "tableFrom": "assets",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.audit_logs": {
      "name": "audit_logs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "actor_type": {
          "name": "actor_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "actor_id": {
          "name": "actor_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "actor_name": {
          "name": "actor_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "action": {
          "name": "action",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "object_type": {
          "name": "object_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "object_id": {
          "name": "object_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "before": {
          "name": "before",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "after": {
          "name": "after",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "ip": {
          "name": "ip",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "at": {
          "name": "at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "audit_ws_at_idx": {
          "name": "audit_ws_at_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.brand_kits": {
      "name": "brand_kits",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "logos": {
          "name": "logos",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::text[]"
        },
        "colors": {
          "name": "colors",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::text[]"
        },
        "fonts": {
          "name": "fonts",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::text[]"
        },
        "voice": {
          "name": "voice",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "brand_kits_workspace_id_workspaces_id_fk": {
          "name": "brand_kits_workspace_id_workspaces_id_fk",
          "tableFrom": "brand_kits",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.broadcasts": {
      "name": "broadcasts",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "channel": {
          "name": "channel",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "segment_id": {
          "name": "segment_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "template_id": {
          "name": "template_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "subject": {
          "name": "subject",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "scheduled_at": {
          "name": "scheduled_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "throttle_per_minute": {
          "name": "throttle_per_minute",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 60
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'draft'"
        },
        "stats": {
          "name": "stats",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "cursor": {
          "name": "cursor",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "broadcasts_workspace_id_workspaces_id_fk": {
          "name": "broadcasts_workspace_id_workspaces_id_fk",
          "tableFrom": "broadcasts",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.campaigns": {
      "name": "campaigns",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "ad_account_id": {
          "name": "ad_account_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "provider": {
          "name": "provider",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "external_id": {
          "name": "external_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "budget": {
          "name": "budget",
          "type": "bigint",
          "primaryKey": false,
          "notNull": false
        },
        "objective": {
          "name": "objective",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "campaigns_workspace_id_workspaces_id_fk": {
          "name": "campaigns_workspace_id_workspaces_id_fk",
          "tableFrom": "campaigns",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "campaigns_ad_account_id_ad_accounts_id_fk": {
          "name": "campaigns_ad_account_id_ad_accounts_id_fk",
          "tableFrom": "campaigns",
          "tableTo": "ad_accounts",
          "columnsFrom": [
            "ad_account_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.canned_replies": {
      "name": "canned_replies",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "shortcut": {
          "name": "shortcut",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "variables": {
          "name": "variables",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::text[]"
        },
        "channels": {
          "name": "channels",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::text[]"
        },
        "tags": {
          "name": "tags",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::text[]"
        },
        "language": {
          "name": "language",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'en'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "canned_replies_workspace_id_workspaces_id_fk": {
          "name": "canned_replies_workspace_id_workspaces_id_fk",
          "tableFrom": "canned_replies",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.comments": {
      "name": "comments",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "conversation_id": {
          "name": "conversation_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "social_object_id": {
          "name": "social_object_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "channel": {
          "name": "channel",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "external_comment_id": {
          "name": "external_comment_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "parent_external_comment_id": {
          "name": "parent_external_comment_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "author_external_id": {
          "name": "author_external_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "author_name": {
          "name": "author_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "author_handle": {
          "name": "author_handle",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "contact_id": {
          "name": "contact_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "direction": {
          "name": "direction",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "edit_history": {
          "name": "edit_history",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'[]'::jsonb"
        },
        "media": {
          "name": "media",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'[]'::jsonb"
        },
        "is_hidden": {
          "name": "is_hidden",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "hidden_reason": {
          "name": "hidden_reason",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "hidden_by": {
          "name": "hidden_by",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_deleted": {
          "name": "is_deleted",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "liked_by_page": {
          "name": "liked_by_page",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "like_count": {
          "name": "like_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "sentiment": {
          "name": "sentiment",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "intent": {
          "name": "intent",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "language": {
          "name": "language",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "toxicity": {
          "name": "toxicity",
          "type": "real",
          "primaryKey": false,
          "notNull": false
        },
        "external_created_at": {
          "name": "external_created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "sent_by_user_id": {
          "name": "sent_by_user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "sent_by_ai": {
          "name": "sent_by_ai",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "sent_by_rule_id": {
          "name": "sent_by_rule_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "provider_status": {
          "name": "provider_status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'received'"
        },
        "provider_error": {
          "name": "provider_error",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "comments_ext_uq": {
          "name": "comments_ext_uq",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "channel",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "external_comment_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "comments_conv_idx": {
          "name": "comments_conv_idx",
          "columns": [
            {
              "expression": "conversation_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "external_created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "comments_workspace_id_workspaces_id_fk": {
          "name": "comments_workspace_id_workspaces_id_fk",
          "tableFrom": "comments",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "comments_conversation_id_conversations_id_fk": {
          "name": "comments_conversation_id_conversations_id_fk",
          "tableFrom": "comments",
          "tableTo": "conversations",
          "columnsFrom": [
            "conversation_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.consents": {
      "name": "consents",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "contact_id": {
          "name": "contact_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "channel": {
          "name": "channel",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "source": {
          "name": "source",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "captured_at": {
          "name": "captured_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "consents_contact_idx": {
          "name": "consents_contact_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "contact_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "channel",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "consents_workspace_id_workspaces_id_fk": {
          "name": "consents_workspace_id_workspaces_id_fk",
          "tableFrom": "consents",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "consents_contact_id_contacts_id_fk": {
          "name": "consents_contact_id_contacts_id_fk",
          "tableFrom": "consents",
          "tableTo": "contacts",
          "columnsFrom": [
            "contact_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.contacts": {
      "name": "contacts",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "first_name": {
          "name": "first_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "last_name": {
          "name": "last_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "phones": {
          "name": "phones",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::text[]"
        },
        "emails": {
          "name": "emails",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::text[]"
        },
        "social_ids": {
          "name": "social_ids",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "owner_id": {
          "name": "owner_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "lifecycle_stage": {
          "name": "lifecycle_stage",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'lead'"
        },
        "score": {
          "name": "score",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "score_reason": {
          "name": "score_reason",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "city": {
          "name": "city",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "territory": {
          "name": "territory",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "project": {
          "name": "project",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "source": {
          "name": "source",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "custom_fields": {
          "name": "custom_fields",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "tags": {
          "name": "tags",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::text[]"
        },
        "merged_into_id": {
          "name": "merged_into_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "first_contacted_at": {
          "name": "first_contacted_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "last_activity_at": {
          "name": "last_activity_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "deleted_at": {
          "name": "deleted_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "contacts_ws_idx": {
          "name": "contacts_ws_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "contacts_owner_idx": {
          "name": "contacts_owner_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "owner_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "contacts_workspace_id_workspaces_id_fk": {
          "name": "contacts_workspace_id_workspaces_id_fk",
          "tableFrom": "contacts",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.content_posts": {
      "name": "content_posts",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "channels": {
          "name": "channels",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true
        },
        "campaign": {
          "name": "campaign",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "media": {
          "name": "media",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'[]'::jsonb"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'draft'"
        },
        "scheduled_at": {
          "name": "scheduled_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "published_at": {
          "name": "published_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "external_post_ids": {
          "name": "external_post_ids",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "approver_id": {
          "name": "approver_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "approval_token": {
          "name": "approval_token",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "approval_note": {
          "name": "approval_note",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "metrics": {
          "name": "metrics",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "content_posts_workspace_id_workspaces_id_fk": {
          "name": "content_posts_workspace_id_workspaces_id_fk",
          "tableFrom": "content_posts",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.conversations": {
      "name": "conversations",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "contact_id": {
          "name": "contact_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "channel": {
          "name": "channel",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'open'"
        },
        "assignee_id": {
          "name": "assignee_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "last_message_at": {
          "name": "last_message_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "unread": {
          "name": "unread",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "ai_agent_active": {
          "name": "ai_agent_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'dm'"
        },
        "social_account_id": {
          "name": "social_account_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "social_object_id": {
          "name": "social_object_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "external_thread_id": {
          "name": "external_thread_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "priority": {
          "name": "priority",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'normal'"
        },
        "sentiment": {
          "name": "sentiment",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "intent": {
          "name": "intent",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "tags": {
          "name": "tags",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::text[]"
        },
        "sla_due_at": {
          "name": "sla_due_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "sla_breached_at": {
          "name": "sla_breached_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "first_response_at": {
          "name": "first_response_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "resolved_at": {
          "name": "resolved_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "last_inbound_at": {
          "name": "last_inbound_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "snoozed_until": {
          "name": "snoozed_until",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "locked_by_user_id": {
          "name": "locked_by_user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "locked_until": {
          "name": "locked_until",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "handled_by": {
          "name": "handled_by",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "conv_ws_idx": {
          "name": "conv_ws_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "last_message_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "conv_ext_thread_uq": {
          "name": "conv_ext_thread_uq",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "channel",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "external_thread_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "conversations_workspace_id_workspaces_id_fk": {
          "name": "conversations_workspace_id_workspaces_id_fk",
          "tableFrom": "conversations",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "conversations_contact_id_contacts_id_fk": {
          "name": "conversations_contact_id_contacts_id_fk",
          "tableFrom": "conversations",
          "tableTo": "contacts",
          "columnsFrom": [
            "contact_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.conversion_syncs": {
      "name": "conversion_syncs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "deal_id": {
          "name": "deal_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "contact_id": {
          "name": "contact_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "provider": {
          "name": "provider",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "event_name": {
          "name": "event_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "event_id": {
          "name": "event_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "value": {
          "name": "value",
          "type": "bigint",
          "primaryKey": false,
          "notNull": false
        },
        "currency": {
          "name": "currency",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "payload": {
          "name": "payload",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "response": {
          "name": "response",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "sent_at": {
          "name": "sent_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "convsync_uq": {
          "name": "convsync_uq",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "provider",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "event_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "conversion_syncs_workspace_id_workspaces_id_fk": {
          "name": "conversion_syncs_workspace_id_workspaces_id_fk",
          "tableFrom": "conversion_syncs",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.custom_field_defs": {
      "name": "custom_field_defs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "object_type": {
          "name": "object_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'contact'"
        },
        "key": {
          "name": "key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "label": {
          "name": "label",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "options": {
          "name": "options",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::text[]"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "cfd_uq": {
          "name": "cfd_uq",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "object_type",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "key",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "custom_field_defs_workspace_id_workspaces_id_fk": {
          "name": "custom_field_defs_workspace_id_workspaces_id_fk",
          "tableFrom": "custom_field_defs",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.custom_object_defs": {
      "name": "custom_object_defs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "key": {
          "name": "key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "label": {
          "name": "label",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "fields": {
          "name": "fields",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "cod_uq": {
          "name": "cod_uq",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "key",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "custom_object_defs_workspace_id_workspaces_id_fk": {
          "name": "custom_object_defs_workspace_id_workspaces_id_fk",
          "tableFrom": "custom_object_defs",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.custom_object_records": {
      "name": "custom_object_records",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "object_def_id": {
          "name": "object_def_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "contact_id": {
          "name": "contact_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "data": {
          "name": "data",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "custom_object_records_workspace_id_workspaces_id_fk": {
          "name": "custom_object_records_workspace_id_workspaces_id_fk",
          "tableFrom": "custom_object_records",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "custom_object_records_object_def_id_custom_object_defs_id_fk": {
          "name": "custom_object_records_object_def_id_custom_object_defs_id_fk",
          "tableFrom": "custom_object_records",
          "tableTo": "custom_object_defs",
          "columnsFrom": [
            "object_def_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "custom_object_records_contact_id_contacts_id_fk": {
          "name": "custom_object_records_contact_id_contacts_id_fk",
          "tableFrom": "custom_object_records",
          "tableTo": "contacts",
          "columnsFrom": [
            "contact_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.deals": {
      "name": "deals",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "contact_id": {
          "name": "contact_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "pipeline_id": {
          "name": "pipeline_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "stage_id": {
          "name": "stage_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "value": {
          "name": "value",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "currency": {
          "name": "currency",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "owner_id": {
          "name": "owner_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "project": {
          "name": "project",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "lost_reason": {
          "name": "lost_reason",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "won_at": {
          "name": "won_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "lost_at": {
          "name": "lost_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "stage_changed_at": {
          "name": "stage_changed_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "position": {
          "name": "position",
          "type": "real",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "sla_due_at": {
          "name": "sla_due_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "sla_breached_at": {
          "name": "sla_breached_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "deals_ws_stage_idx": {
          "name": "deals_ws_stage_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "pipeline_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "stage_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "deals_workspace_id_workspaces_id_fk": {
          "name": "deals_workspace_id_workspaces_id_fk",
          "tableFrom": "deals",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "deals_contact_id_contacts_id_fk": {
          "name": "deals_contact_id_contacts_id_fk",
          "tableFrom": "deals",
          "tableTo": "contacts",
          "columnsFrom": [
            "contact_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "deals_pipeline_id_pipelines_id_fk": {
          "name": "deals_pipeline_id_pipelines_id_fk",
          "tableFrom": "deals",
          "tableTo": "pipelines",
          "columnsFrom": [
            "pipeline_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.engagement_metrics_daily": {
      "name": "engagement_metrics_daily",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "date": {
          "name": "date",
          "type": "date",
          "primaryKey": false,
          "notNull": true
        },
        "social_account_id": {
          "name": "social_account_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "channel": {
          "name": "channel",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "inbound_count": {
          "name": "inbound_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "replied_count": {
          "name": "replied_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "median_first_response_s": {
          "name": "median_first_response_s",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "p90_first_response_s": {
          "name": "p90_first_response_s",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "resolved_count": {
          "name": "resolved_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "hidden_count": {
          "name": "hidden_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "negative_count": {
          "name": "negative_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "leads_created": {
          "name": "leads_created",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        }
      },
      "indexes": {
        "eng_metrics_idx": {
          "name": "eng_metrics_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "date",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "engagement_metrics_daily_workspace_id_workspaces_id_fk": {
          "name": "engagement_metrics_daily_workspace_id_workspaces_id_fk",
          "tableFrom": "engagement_metrics_daily",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.engagement_rules": {
      "name": "engagement_rules",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "channels": {
          "name": "channels",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::text[]"
        },
        "social_account_ids": {
          "name": "social_account_ids",
          "type": "uuid[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::uuid[]"
        },
        "social_object_ids": {
          "name": "social_object_ids",
          "type": "uuid[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::uuid[]"
        },
        "trigger": {
          "name": "trigger",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'new_comment'"
        },
        "conditions": {
          "name": "conditions",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "actions": {
          "name": "actions",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'[]'::jsonb"
        },
        "priority": {
          "name": "priority",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 100
        },
        "stop_processing": {
          "name": "stop_processing",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "schedule": {
          "name": "schedule",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "rate_limit": {
          "name": "rate_limit",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "stats": {
          "name": "stats",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "engagement_rules_ws_idx": {
          "name": "engagement_rules_ws_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "priority",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "engagement_rules_workspace_id_workspaces_id_fk": {
          "name": "engagement_rules_workspace_id_workspaces_id_fk",
          "tableFrom": "engagement_rules",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.events": {
      "name": "events",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "contact_id": {
          "name": "contact_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "anonymous_id": {
          "name": "anonymous_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "properties": {
          "name": "properties",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "source": {
          "name": "source",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'api'"
        },
        "occurred_at": {
          "name": "occurred_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "events_contact_idx": {
          "name": "events_contact_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "contact_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "occurred_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "events_anon_idx": {
          "name": "events_anon_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "anonymous_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "events_workspace_id_workspaces_id_fk": {
          "name": "events_workspace_id_workspaces_id_fk",
          "tableFrom": "events",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.forms": {
      "name": "forms",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "slug": {
          "name": "slug",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "schema": {
          "name": "schema",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "variants": {
          "name": "variants",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'[]'::jsonb"
        },
        "domain": {
          "name": "domain",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "published_version": {
          "name": "published_version",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'draft'"
        },
        "pixels": {
          "name": "pixels",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "stats": {
          "name": "stats",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "forms_slug_uq": {
          "name": "forms_slug_uq",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "slug",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "forms_workspace_id_workspaces_id_fk": {
          "name": "forms_workspace_id_workspaces_id_fk",
          "tableFrom": "forms",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.idempotency_keys": {
      "name": "idempotency_keys",
      "schema": "",
      "columns": {
        "key": {
          "name": "key",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "response": {
          "name": "response",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "status_code": {
          "name": "status_code",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.identities": {
      "name": "identities",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "contact_id": {
          "name": "contact_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "value_normalized": {
          "name": "value_normalized",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "identities_uq": {
          "name": "identities_uq",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "type",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "value_normalized",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "identities_workspace_id_workspaces_id_fk": {
          "name": "identities_workspace_id_workspaces_id_fk",
          "tableFrom": "identities",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "identities_contact_id_contacts_id_fk": {
          "name": "identities_contact_id_contacts_id_fk",
          "tableFrom": "identities",
          "tableTo": "contacts",
          "columnsFrom": [
            "contact_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.integration_logs": {
      "name": "integration_logs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "integration_id": {
          "name": "integration_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "provider": {
          "name": "provider",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "direction": {
          "name": "direction",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "operation": {
          "name": "operation",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "summary": {
          "name": "summary",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "at": {
          "name": "at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "intlog_ws_idx": {
          "name": "intlog_ws_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "integration_logs_workspace_id_workspaces_id_fk": {
          "name": "integration_logs_workspace_id_workspaces_id_fk",
          "tableFrom": "integration_logs",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.integrations": {
      "name": "integrations",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "provider": {
          "name": "provider",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "account_ref": {
          "name": "account_ref",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "display_name": {
          "name": "display_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "scopes": {
          "name": "scopes",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::text[]"
        },
        "token_ref": {
          "name": "token_ref",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "config": {
          "name": "config",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "field_mapping": {
          "name": "field_mapping",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'connected'"
        },
        "mode": {
          "name": "mode",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'sandbox'"
        },
        "last_sync_at": {
          "name": "last_sync_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "last_error": {
          "name": "last_error",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "integrations_workspace_id_workspaces_id_fk": {
          "name": "integrations_workspace_id_workspaces_id_fk",
          "tableFrom": "integrations",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.invoices": {
      "name": "invoices",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "period": {
          "name": "period",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "provider": {
          "name": "provider",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "amount": {
          "name": "amount",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true
        },
        "currency": {
          "name": "currency",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "lines": {
          "name": "lines",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'open'"
        },
        "external_id": {
          "name": "external_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "invoices_workspace_id_workspaces_id_fk": {
          "name": "invoices_workspace_id_workspaces_id_fk",
          "tableFrom": "invoices",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.jobs": {
      "name": "jobs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "payload": {
          "name": "payload",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'queued'"
        },
        "attempts": {
          "name": "attempts",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "max_attempts": {
          "name": "max_attempts",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 8
        },
        "run_at": {
          "name": "run_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "locked_at": {
          "name": "locked_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "last_error": {
          "name": "last_error",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "idempotency_key": {
          "name": "idempotency_key",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "jobs_pick_idx": {
          "name": "jobs_pick_idx",
          "columns": [
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "run_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "jobs_idem_uq": {
          "name": "jobs_idem_uq",
          "columns": [
            {
              "expression": "idempotency_key",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.journey_runs": {
      "name": "journey_runs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "journey_id": {
          "name": "journey_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "version": {
          "name": "version",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "contact_id": {
          "name": "contact_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "current_step": {
          "name": "current_step",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "resume_at": {
          "name": "resume_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "log": {
          "name": "log",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'[]'::jsonb"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "runs_resume_idx": {
          "name": "runs_resume_idx",
          "columns": [
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "resume_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "journey_runs_workspace_id_workspaces_id_fk": {
          "name": "journey_runs_workspace_id_workspaces_id_fk",
          "tableFrom": "journey_runs",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "journey_runs_journey_id_journeys_id_fk": {
          "name": "journey_runs_journey_id_journeys_id_fk",
          "tableFrom": "journey_runs",
          "tableTo": "journeys",
          "columnsFrom": [
            "journey_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "journey_runs_contact_id_contacts_id_fk": {
          "name": "journey_runs_contact_id_contacts_id_fk",
          "tableFrom": "journey_runs",
          "tableTo": "contacts",
          "columnsFrom": [
            "contact_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.journey_versions": {
      "name": "journey_versions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "journey_id": {
          "name": "journey_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "version": {
          "name": "version",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "trigger": {
          "name": "trigger",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "graph": {
          "name": "graph",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "goal": {
          "name": "goal",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "jv_uq": {
          "name": "jv_uq",
          "columns": [
            {
              "expression": "journey_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "version",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "journey_versions_workspace_id_workspaces_id_fk": {
          "name": "journey_versions_workspace_id_workspaces_id_fk",
          "tableFrom": "journey_versions",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "journey_versions_journey_id_journeys_id_fk": {
          "name": "journey_versions_journey_id_journeys_id_fk",
          "tableFrom": "journey_versions",
          "tableTo": "journeys",
          "columnsFrom": [
            "journey_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.journeys": {
      "name": "journeys",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'draft'"
        },
        "version": {
          "name": "version",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "trigger": {
          "name": "trigger",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "graph": {
          "name": "graph",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "goal": {
          "name": "goal",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "stats": {
          "name": "stats",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "journeys_workspace_id_workspaces_id_fk": {
          "name": "journeys_workspace_id_workspaces_id_fk",
          "tableFrom": "journeys",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.knowledge_entries": {
      "name": "knowledge_entries",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "question": {
          "name": "question",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "answer": {
          "name": "answer",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "scope": {
          "name": "scope",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "social_account_id": {
          "name": "social_account_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "language": {
          "name": "language",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'en'"
        },
        "tags": {
          "name": "tags",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::text[]"
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "knowledge_entries_workspace_id_workspaces_id_fk": {
          "name": "knowledge_entries_workspace_id_workspaces_id_fk",
          "tableFrom": "knowledge_entries",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.lead_sources": {
      "name": "lead_sources",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "contact_id": {
          "name": "contact_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "deal_id": {
          "name": "deal_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "channel": {
          "name": "channel",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "campaign_id": {
          "name": "campaign_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "adset_id": {
          "name": "adset_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "ad_id": {
          "name": "ad_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "utm_source": {
          "name": "utm_source",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "utm_medium": {
          "name": "utm_medium",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "utm_campaign": {
          "name": "utm_campaign",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "utm_term": {
          "name": "utm_term",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "utm_content": {
          "name": "utm_content",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "fbclid": {
          "name": "fbclid",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "gclid": {
          "name": "gclid",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "landing_url": {
          "name": "landing_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "form_id": {
          "name": "form_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "captured_at": {
          "name": "captured_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "lead_sources_contact_idx": {
          "name": "lead_sources_contact_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "contact_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "lead_sources_workspace_id_workspaces_id_fk": {
          "name": "lead_sources_workspace_id_workspaces_id_fk",
          "tableFrom": "lead_sources",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "lead_sources_contact_id_contacts_id_fk": {
          "name": "lead_sources_contact_id_contacts_id_fk",
          "tableFrom": "lead_sources",
          "tableTo": "contacts",
          "columnsFrom": [
            "contact_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.memberships": {
      "name": "memberships",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "role_id": {
          "name": "role_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "territory": {
          "name": "territory",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "projects": {
          "name": "projects",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::text[]"
        },
        "active": {
          "name": "active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "team": {
          "name": "team",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "availability": {
          "name": "availability",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'online'"
        },
        "social_account_ids": {
          "name": "social_account_ids",
          "type": "uuid[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::uuid[]"
        },
        "dashboard_layout": {
          "name": "dashboard_layout",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "memberships_uq": {
          "name": "memberships_uq",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "memberships_workspace_id_workspaces_id_fk": {
          "name": "memberships_workspace_id_workspaces_id_fk",
          "tableFrom": "memberships",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "memberships_user_id_users_id_fk": {
          "name": "memberships_user_id_users_id_fk",
          "tableFrom": "memberships",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "memberships_role_id_roles_id_fk": {
          "name": "memberships_role_id_roles_id_fk",
          "tableFrom": "memberships",
          "tableTo": "roles",
          "columnsFrom": [
            "role_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.merge_logs": {
      "name": "merge_logs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "survivor_id": {
          "name": "survivor_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "merged_id": {
          "name": "merged_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "reason": {
          "name": "reason",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "snapshot": {
          "name": "snapshot",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "undone_at": {
          "name": "undone_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "merge_logs_workspace_id_workspaces_id_fk": {
          "name": "merge_logs_workspace_id_workspaces_id_fk",
          "tableFrom": "merge_logs",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.messages": {
      "name": "messages",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "conversation_id": {
          "name": "conversation_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "direction": {
          "name": "direction",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "channel": {
          "name": "channel",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "template_id": {
          "name": "template_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "subject": {
          "name": "subject",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "media": {
          "name": "media",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'[]'::jsonb"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'queued'"
        },
        "error": {
          "name": "error",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "provider_message_id": {
          "name": "provider_message_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "sender_id": {
          "name": "sender_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "broadcast_id": {
          "name": "broadcast_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "opened_at": {
          "name": "opened_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "clicked_at": {
          "name": "clicked_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "messages_conv_idx": {
          "name": "messages_conv_idx",
          "columns": [
            {
              "expression": "conversation_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "messages_provider_idx": {
          "name": "messages_provider_idx",
          "columns": [
            {
              "expression": "provider_message_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "messages_workspace_id_workspaces_id_fk": {
          "name": "messages_workspace_id_workspaces_id_fk",
          "tableFrom": "messages",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "messages_conversation_id_conversations_id_fk": {
          "name": "messages_conversation_id_conversations_id_fk",
          "tableFrom": "messages",
          "tableTo": "conversations",
          "columnsFrom": [
            "conversation_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.messaging_windows": {
      "name": "messaging_windows",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "contact_id": {
          "name": "contact_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "channel": {
          "name": "channel",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "social_account_id": {
          "name": "social_account_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "last_inbound_at": {
          "name": "last_inbound_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        },
        "window_expires_at": {
          "name": "window_expires_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        },
        "private_reply_available_until": {
          "name": "private_reply_available_until",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "msg_windows_uq": {
          "name": "msg_windows_uq",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "contact_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "channel",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "messaging_windows_workspace_id_workspaces_id_fk": {
          "name": "messaging_windows_workspace_id_workspaces_id_fk",
          "tableFrom": "messaging_windows",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "messaging_windows_contact_id_contacts_id_fk": {
          "name": "messaging_windows_contact_id_contacts_id_fk",
          "tableFrom": "messaging_windows",
          "tableTo": "contacts",
          "columnsFrom": [
            "contact_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.mfa_backup_codes": {
      "name": "mfa_backup_codes",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "code_hash": {
          "name": "code_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "used_at": {
          "name": "used_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "mfa_backup_user_idx": {
          "name": "mfa_backup_user_idx",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "mfa_backup_codes_user_id_users_id_fk": {
          "name": "mfa_backup_codes_user_id_users_id_fk",
          "tableFrom": "mfa_backup_codes",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.mfa_challenges": {
      "name": "mfa_challenges",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "session_id": {
          "name": "session_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "method_id": {
          "name": "method_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "purpose": {
          "name": "purpose",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "code_hash": {
          "name": "code_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "challenge": {
          "name": "challenge",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "attempts": {
          "name": "attempts",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        },
        "consumed_at": {
          "name": "consumed_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "mfa_challenges_user_idx": {
          "name": "mfa_challenges_user_idx",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "mfa_challenges_user_id_users_id_fk": {
          "name": "mfa_challenges_user_id_users_id_fk",
          "tableFrom": "mfa_challenges",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.mfa_methods": {
      "name": "mfa_methods",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "label": {
          "name": "label",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "target": {
          "name": "target",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "secret_enc": {
          "name": "secret_enc",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "credential_id": {
          "name": "credential_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "public_key": {
          "name": "public_key",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "counter": {
          "name": "counter",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "transports": {
          "name": "transports",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::text[]"
        },
        "last_used_step": {
          "name": "last_used_step",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "verified_at": {
          "name": "verified_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "last_used_at": {
          "name": "last_used_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "mfa_methods_user_idx": {
          "name": "mfa_methods_user_idx",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "mfa_methods_cred_uq": {
          "name": "mfa_methods_cred_uq",
          "columns": [
            {
              "expression": "credential_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "mfa_methods_user_id_users_id_fk": {
          "name": "mfa_methods_user_id_users_id_fk",
          "tableFrom": "mfa_methods",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.moderation_events": {
      "name": "moderation_events",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "comment_id": {
          "name": "comment_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "action": {
          "name": "action",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "reason": {
          "name": "reason",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "actor_type": {
          "name": "actor_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "actor_id": {
          "name": "actor_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "actor_name": {
          "name": "actor_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "undone_at": {
          "name": "undone_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "moderation_events_ws_idx": {
          "name": "moderation_events_ws_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "moderation_events_workspace_id_workspaces_id_fk": {
          "name": "moderation_events_workspace_id_workspaces_id_fk",
          "tableFrom": "moderation_events",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "moderation_events_comment_id_comments_id_fk": {
          "name": "moderation_events_comment_id_comments_id_fk",
          "tableFrom": "moderation_events",
          "tableTo": "comments",
          "columnsFrom": [
            "comment_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.notifications": {
      "name": "notifications",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "link": {
          "name": "link",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "read_at": {
          "name": "read_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "notif_user_idx": {
          "name": "notif_user_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "notifications_workspace_id_workspaces_id_fk": {
          "name": "notifications_workspace_id_workspaces_id_fk",
          "tableFrom": "notifications",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.pipelines": {
      "name": "pipelines",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "is_default": {
          "name": "is_default",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "stages": {
          "name": "stages",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "sla_minutes": {
          "name": "sla_minutes",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 5
        },
        "sla_action": {
          "name": "sla_action",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'alert'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "pipelines_workspace_id_workspaces_id_fk": {
          "name": "pipelines_workspace_id_workspaces_id_fk",
          "tableFrom": "pipelines",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.rate_limits": {
      "name": "rate_limits",
      "schema": "",
      "columns": {
        "bucket": {
          "name": "bucket",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "count": {
          "name": "count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "window_start": {
          "name": "window_start",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.registrations": {
      "name": "registrations",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "phone": {
          "name": "phone",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "password_hash": {
          "name": "password_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "email_code_hash": {
          "name": "email_code_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "phone_code_hash": {
          "name": "phone_code_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "email_verified_at": {
          "name": "email_verified_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "phone_verified_at": {
          "name": "phone_verified_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "attempts": {
          "name": "attempts",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "sends": {
          "name": "sends",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "last_sent_at": {
          "name": "last_sent_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "ip": {
          "name": "ip",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        },
        "completed_at": {
          "name": "completed_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "registrations_email_idx": {
          "name": "registrations_email_idx",
          "columns": [
            {
              "expression": "email",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.reviews": {
      "name": "reviews",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "conversation_id": {
          "name": "conversation_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "social_account_id": {
          "name": "social_account_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "external_review_id": {
          "name": "external_review_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "reviewer_name": {
          "name": "reviewer_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "rating": {
          "name": "rating",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "language": {
          "name": "language",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "external_created_at": {
          "name": "external_created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "reply_body": {
          "name": "reply_body",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "reply_status": {
          "name": "reply_status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'none'"
        },
        "replied_at": {
          "name": "replied_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "replied_by_user_id": {
          "name": "replied_by_user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "replied_by_ai": {
          "name": "replied_by_ai",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "reviews_ext_uq": {
          "name": "reviews_ext_uq",
          "columns": [
            {
              "expression": "social_account_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "external_review_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "reviews_workspace_id_workspaces_id_fk": {
          "name": "reviews_workspace_id_workspaces_id_fk",
          "tableFrom": "reviews",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "reviews_conversation_id_conversations_id_fk": {
          "name": "reviews_conversation_id_conversations_id_fk",
          "tableFrom": "reviews",
          "tableTo": "conversations",
          "columnsFrom": [
            "conversation_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "reviews_social_account_id_social_accounts_id_fk": {
          "name": "reviews_social_account_id_social_accounts_id_fk",
          "tableFrom": "reviews",
          "tableTo": "social_accounts",
          "columnsFrom": [
            "social_account_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.roles": {
      "name": "roles",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "key": {
          "name": "key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "permissions": {
          "name": "permissions",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "is_system": {
          "name": "is_system",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "roles_workspace_id_workspaces_id_fk": {
          "name": "roles_workspace_id_workspaces_id_fk",
          "tableFrom": "roles",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.routing_rules": {
      "name": "routing_rules",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "priority": {
          "name": "priority",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 100
        },
        "strategy": {
          "name": "strategy",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "match": {
          "name": "match",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "user_ids": {
          "name": "user_ids",
          "type": "uuid[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::uuid[]"
        },
        "cursor": {
          "name": "cursor",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "active": {
          "name": "active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "routing_rules_workspace_id_workspaces_id_fk": {
          "name": "routing_rules_workspace_id_workspaces_id_fk",
          "tableFrom": "routing_rules",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.rule_firings": {
      "name": "rule_firings",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "rule_id": {
          "name": "rule_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "conversation_id": {
          "name": "conversation_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "author_external_id": {
          "name": "author_external_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "social_object_id": {
          "name": "social_object_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "actions": {
          "name": "actions",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'[]'::jsonb"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "rule_firings_idx": {
          "name": "rule_firings_idx",
          "columns": [
            {
              "expression": "rule_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "rule_firings_workspace_id_workspaces_id_fk": {
          "name": "rule_firings_workspace_id_workspaces_id_fk",
          "tableFrom": "rule_firings",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "rule_firings_rule_id_engagement_rules_id_fk": {
          "name": "rule_firings_rule_id_engagement_rules_id_fk",
          "tableFrom": "rule_firings",
          "tableTo": "engagement_rules",
          "columnsFrom": [
            "rule_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.saved_reports": {
      "name": "saved_reports",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "config": {
          "name": "config",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "schedule": {
          "name": "schedule",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "recipients": {
          "name": "recipients",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::text[]"
        },
        "share_token": {
          "name": "share_token",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "last_sent_at": {
          "name": "last_sent_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "saved_reports_workspace_id_workspaces_id_fk": {
          "name": "saved_reports_workspace_id_workspaces_id_fk",
          "tableFrom": "saved_reports",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.secrets": {
      "name": "secrets",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "ciphertext": {
          "name": "ciphertext",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.segments": {
      "name": "segments",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "definition": {
          "name": "definition",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "member_count": {
          "name": "member_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "evaluated_at": {
          "name": "evaluated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "audience_sync": {
          "name": "audience_sync",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "segments_workspace_id_workspaces_id_fk": {
          "name": "segments_workspace_id_workspaces_id_fk",
          "tableFrom": "segments",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.sessions": {
      "name": "sessions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "mfa_passed": {
          "name": "mfa_passed",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "mfa_method": {
          "name": "mfa_method",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "last_seen_at": {
          "name": "last_seen_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        },
        "user_agent": {
          "name": "user_agent",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "ip": {
          "name": "ip",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "sessions_user_id_users_id_fk": {
          "name": "sessions_user_id_users_id_fk",
          "tableFrom": "sessions",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.social_accounts": {
      "name": "social_accounts",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "integration_id": {
          "name": "integration_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "channel_family": {
          "name": "channel_family",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "platform": {
          "name": "platform",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "external_account_id": {
          "name": "external_account_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "avatar_url": {
          "name": "avatar_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'inactive'"
        },
        "capabilities": {
          "name": "capabilities",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "webhook_subscribed": {
          "name": "webhook_subscribed",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "last_event_at": {
          "name": "last_event_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "last_polled_at": {
          "name": "last_polled_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "poll_cursor": {
          "name": "poll_cursor",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "backfill": {
          "name": "backfill",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "last_error": {
          "name": "last_error",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "social_accounts_uq": {
          "name": "social_accounts_uq",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "platform",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "external_account_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "social_accounts_ext_idx": {
          "name": "social_accounts_ext_idx",
          "columns": [
            {
              "expression": "external_account_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "social_accounts_workspace_id_workspaces_id_fk": {
          "name": "social_accounts_workspace_id_workspaces_id_fk",
          "tableFrom": "social_accounts",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.social_blocklist": {
      "name": "social_blocklist",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "platform": {
          "name": "platform",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "author_external_id": {
          "name": "author_external_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "author_name": {
          "name": "author_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "reason": {
          "name": "reason",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "social_blocklist_uq": {
          "name": "social_blocklist_uq",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "platform",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "author_external_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "social_blocklist_workspace_id_workspaces_id_fk": {
          "name": "social_blocklist_workspace_id_workspaces_id_fk",
          "tableFrom": "social_blocklist",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.social_objects": {
      "name": "social_objects",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "social_account_id": {
          "name": "social_account_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "external_id": {
          "name": "external_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "permalink": {
          "name": "permalink",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "thumbnail_url": {
          "name": "thumbnail_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "caption_excerpt": {
          "name": "caption_excerpt",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "ad_id": {
          "name": "ad_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "external_ad_id": {
          "name": "external_ad_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "campaign_id": {
          "name": "campaign_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "campaign_name": {
          "name": "campaign_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "published_at": {
          "name": "published_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "social_objects_uq": {
          "name": "social_objects_uq",
          "columns": [
            {
              "expression": "social_account_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "external_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "social_objects_workspace_id_workspaces_id_fk": {
          "name": "social_objects_workspace_id_workspaces_id_fk",
          "tableFrom": "social_objects",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "social_objects_social_account_id_social_accounts_id_fk": {
          "name": "social_objects_social_account_id_social_accounts_id_fk",
          "tableFrom": "social_objects",
          "tableTo": "social_accounts",
          "columnsFrom": [
            "social_account_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.submissions": {
      "name": "submissions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "form_id": {
          "name": "form_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "contact_id": {
          "name": "contact_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "variant": {
          "name": "variant",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "data": {
          "name": "data",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "meta": {
          "name": "meta",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "submissions_workspace_id_workspaces_id_fk": {
          "name": "submissions_workspace_id_workspaces_id_fk",
          "tableFrom": "submissions",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "submissions_form_id_forms_id_fk": {
          "name": "submissions_form_id_forms_id_fk",
          "tableFrom": "submissions",
          "tableTo": "forms",
          "columnsFrom": [
            "form_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.templates": {
      "name": "templates",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "channel": {
          "name": "channel",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "language": {
          "name": "language",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'en'"
        },
        "subject": {
          "name": "subject",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "variables": {
          "name": "variables",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::text[]"
        },
        "provider_status": {
          "name": "provider_status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'draft'"
        },
        "category": {
          "name": "category",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'marketing'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "templates_workspace_id_workspaces_id_fk": {
          "name": "templates_workspace_id_workspaces_id_fk",
          "tableFrom": "templates",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.trusted_devices": {
      "name": "trusted_devices",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "token_hash": {
          "name": "token_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "user_agent": {
          "name": "user_agent",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "ip": {
          "name": "ip",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        },
        "last_used_at": {
          "name": "last_used_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "trusted_devices_token_uq": {
          "name": "trusted_devices_token_uq",
          "columns": [
            {
              "expression": "token_hash",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "trusted_devices_user_id_users_id_fk": {
          "name": "trusted_devices_user_id_users_id_fk",
          "tableFrom": "trusted_devices",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.usage_records": {
      "name": "usage_records",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "meter": {
          "name": "meter",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "quantity": {
          "name": "quantity",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "period": {
          "name": "period",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "usage_ws_period_idx": {
          "name": "usage_ws_period_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "period",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "meter",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "usage_records_workspace_id_workspaces_id_fk": {
          "name": "usage_records_workspace_id_workspaces_id_fk",
          "tableFrom": "usage_records",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.users": {
      "name": "users",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "phone": {
          "name": "phone",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "password_hash": {
          "name": "password_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "google_sub": {
          "name": "google_sub",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "mfa_enabled": {
          "name": "mfa_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "mfa_secret": {
          "name": "mfa_secret",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "is_agency_admin": {
          "name": "is_agency_admin",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "agency_id": {
          "name": "agency_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "locale": {
          "name": "locale",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "last_login_at": {
          "name": "last_login_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "email_verified_at": {
          "name": "email_verified_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "phone_verified_at": {
          "name": "phone_verified_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "failed_logins": {
          "name": "failed_logins",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "locked_until": {
          "name": "locked_until",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "password_changed_at": {
          "name": "password_changed_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "users_email_uq": {
          "name": "users_email_uq",
          "columns": [
            {
              "expression": "email",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "users_agency_id_agencies_id_fk": {
          "name": "users_agency_id_agencies_id_fk",
          "tableFrom": "users",
          "tableTo": "agencies",
          "columnsFrom": [
            "agency_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.webhook_deliveries": {
      "name": "webhook_deliveries",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "subscription_id": {
          "name": "subscription_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "event_id": {
          "name": "event_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "event_type": {
          "name": "event_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "payload": {
          "name": "payload",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "attempts": {
          "name": "attempts",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "response_code": {
          "name": "response_code",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "next_attempt_at": {
          "name": "next_attempt_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "webhook_deliveries_workspace_id_workspaces_id_fk": {
          "name": "webhook_deliveries_workspace_id_workspaces_id_fk",
          "tableFrom": "webhook_deliveries",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "webhook_deliveries_subscription_id_webhook_subscriptions_id_fk": {
          "name": "webhook_deliveries_subscription_id_webhook_subscriptions_id_fk",
          "tableFrom": "webhook_deliveries",
          "tableTo": "webhook_subscriptions",
          "columnsFrom": [
            "subscription_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.webhook_subscriptions": {
      "name": "webhook_subscriptions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "url": {
          "name": "url",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "events": {
          "name": "events",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true
        },
        "secret": {
          "name": "secret",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "webhook_subscriptions_workspace_id_workspaces_id_fk": {
          "name": "webhook_subscriptions_workspace_id_workspaces_id_fk",
          "tableFrom": "webhook_subscriptions",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.workspaces": {
      "name": "workspaces",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "agency_id": {
          "name": "agency_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "slug": {
          "name": "slug",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "hook_key": {
          "name": "hook_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "timezone": {
          "name": "timezone",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'Asia/Dhaka'"
        },
        "currency": {
          "name": "currency",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'BDT'"
        },
        "locale": {
          "name": "locale",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'en'"
        },
        "plan": {
          "name": "plan",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'growth'"
        },
        "settings": {
          "name": "settings",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "subscription_status": {
          "name": "subscription_status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "trial_ends_at": {
          "name": "trial_ends_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "current_period_end": {
          "name": "current_period_end",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "billing_customer_id": {
          "name": "billing_customer_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "billing_subscription_id": {
          "name": "billing_subscription_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "workspaces_slug_uq": {
          "name": "workspaces_slug_uq",
          "columns": [
            {
              "expression": "slug",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "workspaces_hook_uq": {
          "name": "workspaces_hook_uq",
          "columns": [
            {
              "expression": "hook_key",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "workspaces_agency_id_agencies_id_fk": {
          "name": "workspaces_agency_id_agencies_id_fk",
          "tableFrom": "workspaces",
          "tableTo": "agencies",
          "columnsFrom": [
            "agency_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    }
  },
  "enums": {},
  "schemas": {},
  "sequences": {},
  "roles": {},
  "policies": {},
  "views": {},
  "_meta": {
    "columns": {},
    "schemas": {},
    "tables": {}
  }
}