{
  "id": "3a5f835e-6b18-4c3b-b562-8dded8643c79",
  "prevId": "00000000-0000-0000-0000-000000000000",
  "version": "7",
  "dialect": "postgresql",
  "tables": {
    "public.ai_comparisons": {
      "name": "ai_comparisons",
      "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
        },
        "prompt": {
          "name": "prompt",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "models": {
          "name": "models",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "results": {
          "name": "results",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'[]'::jsonb"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "ai_comparisons_workspace_id_workspaces_id_fk": {
          "name": "ai_comparisons_workspace_id_workspaces_id_fk",
          "tableFrom": "ai_comparisons",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.ai_conversations": {
      "name": "ai_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
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'New conversation'"
        },
        "page_id": {
          "name": "page_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "model": {
          "name": "model",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "routing": {
          "name": "routing",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'auto'"
        },
        "pinned": {
          "name": "pinned",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "deleted_at": {
          "name": "deleted_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "ai_conv_ws_idx": {
          "name": "ai_conv_ws_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "updated_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "ai_conversations_workspace_id_workspaces_id_fk": {
          "name": "ai_conversations_workspace_id_workspaces_id_fk",
          "tableFrom": "ai_conversations",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "ai_conversations_page_id_pages_id_fk": {
          "name": "ai_conversations_page_id_pages_id_fk",
          "tableFrom": "ai_conversations",
          "tableTo": "pages",
          "columnsFrom": [
            "page_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.ai_executions": {
      "name": "ai_executions",
      "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
        },
        "task": {
          "name": "task",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "model": {
          "name": "model",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "scopes": {
          "name": "scopes",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'[]'::jsonb"
        },
        "tools_invoked": {
          "name": "tools_invoked",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "documents_accessed": {
          "name": "documents_accessed",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "proposed_changes": {
          "name": "proposed_changes",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "approvals": {
          "name": "approvals",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "outcome": {
          "name": "outcome",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "result": {
          "name": "result",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "error": {
          "name": "error",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "cost_usd": {
          "name": "cost_usd",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false,
          "default": 0
        },
        "tokens_in": {
          "name": "tokens_in",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 0
        },
        "tokens_out": {
          "name": "tokens_out",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "started_at": {
          "name": "started_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "finished_at": {
          "name": "finished_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "ai_exec_ws_idx": {
          "name": "ai_exec_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": {
        "ai_executions_workspace_id_workspaces_id_fk": {
          "name": "ai_executions_workspace_id_workspaces_id_fk",
          "tableFrom": "ai_executions",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.ai_messages": {
      "name": "ai_messages",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "conversation_id": {
          "name": "conversation_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "role": {
          "name": "role",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "content": {
          "name": "content",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "model": {
          "name": "model",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "provider": {
          "name": "provider",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "sources": {
          "name": "sources",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "usage": {
          "name": "usage",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "cost_usd": {
          "name": "cost_usd",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false
        },
        "latency_ms": {
          "name": "latency_ms",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "ttft_ms": {
          "name": "ttft_ms",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "meta": {
          "name": "meta",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "ai_msgs_conv_idx": {
          "name": "ai_msgs_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": {}
        }
      },
      "foreignKeys": {
        "ai_messages_conversation_id_ai_conversations_id_fk": {
          "name": "ai_messages_conversation_id_ai_conversations_id_fk",
          "tableFrom": "ai_messages",
          "tableTo": "ai_conversations",
          "columnsFrom": [
            "conversation_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.ai_models": {
      "name": "ai_models",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "provider": {
          "name": "provider",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "display_name": {
          "name": "display_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "category": {
          "name": "category",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'text'"
        },
        "available": {
          "name": "available",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "enabled": {
          "name": "enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "context_window": {
          "name": "context_window",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "max_output": {
          "name": "max_output",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "input_price": {
          "name": "input_price",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false
        },
        "cached_price": {
          "name": "cached_price",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false
        },
        "output_price": {
          "name": "output_price",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false
        },
        "pricing_source": {
          "name": "pricing_source",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "probes": {
          "name": "probes",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "benchmark": {
          "name": "benchmark",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "capabilities": {
          "name": "capabilities",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "notes": {
          "name": "notes",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "discovered_at": {
          "name": "discovered_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "probed_at": {
          "name": "probed_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "benchmarked_at": {
          "name": "benchmarked_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "ai_models_provider_ai_providers_id_fk": {
          "name": "ai_models_provider_ai_providers_id_fk",
          "tableFrom": "ai_models",
          "tableTo": "ai_providers",
          "columnsFrom": [
            "provider"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.ai_providers": {
      "name": "ai_providers",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "enabled": {
          "name": "enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "last_discovery_at": {
          "name": "last_discovery_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'unknown'"
        },
        "status_detail": {
          "name": "status_detail",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.ai_usage": {
      "name": "ai_usage",
      "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
        },
        "provider": {
          "name": "provider",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "model": {
          "name": "model",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "task": {
          "name": "task",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "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
        },
        "cached_tokens": {
          "name": "cached_tokens",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 0
        },
        "reasoning_tokens": {
          "name": "reasoning_tokens",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 0
        },
        "cost_usd": {
          "name": "cost_usd",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false
        },
        "latency_ms": {
          "name": "latency_ms",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "ttft_ms": {
          "name": "ttft_ms",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "ok": {
          "name": "ok",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "error": {
          "name": "error",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "ref_id": {
          "name": "ref_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "ai_usage_created_idx": {
          "name": "ai_usage_created_idx",
          "columns": [
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.attachments": {
      "name": "attachments",
      "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
        },
        "page_id": {
          "name": "page_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "filename": {
          "name": "filename",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "mime": {
          "name": "mime",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "size": {
          "name": "size",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true
        },
        "sha256": {
          "name": "sha256",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "storage_path": {
          "name": "storage_path",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "extracted_text": {
          "name": "extracted_text",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "page_count": {
          "name": "page_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "meta": {
          "name": "meta",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "deleted_at": {
          "name": "deleted_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "attachments_page_idx": {
          "name": "attachments_page_idx",
          "columns": [
            {
              "expression": "page_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "attachments_sha_idx": {
          "name": "attachments_sha_idx",
          "columns": [
            {
              "expression": "sha256",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "attachments_workspace_id_workspaces_id_fk": {
          "name": "attachments_workspace_id_workspaces_id_fk",
          "tableFrom": "attachments",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "attachments_page_id_pages_id_fk": {
          "name": "attachments_page_id_pages_id_fk",
          "tableFrom": "attachments",
          "tableTo": "pages",
          "columnsFrom": [
            "page_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "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()"
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "action": {
          "name": "action",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "target_type": {
          "name": "target_type",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "target_id": {
          "name": "target_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "detail": {
          "name": "detail",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "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": {
        "audit_created_idx": {
          "name": "audit_created_idx",
          "columns": [
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.backup_jobs": {
      "name": "backup_jobs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'full'"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'running'"
        },
        "path": {
          "name": "path",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "size_bytes": {
          "name": "size_bytes",
          "type": "bigint",
          "primaryKey": false,
          "notNull": false
        },
        "sha256": {
          "name": "sha256",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "offsite": {
          "name": "offsite",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "error": {
          "name": "error",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "started_at": {
          "name": "started_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "finished_at": {
          "name": "finished_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.chunks": {
      "name": "chunks",
      "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
        },
        "source_type": {
          "name": "source_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "source_id": {
          "name": "source_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "page_id": {
          "name": "page_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "ordinal": {
          "name": "ordinal",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "block_id": {
          "name": "block_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "heading": {
          "name": "heading",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "content": {
          "name": "content",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "token_count": {
          "name": "token_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "content_hash": {
          "name": "content_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "tsv": {
          "name": "tsv",
          "type": "tsvector",
          "primaryKey": false,
          "notNull": false,
          "generated": {
            "as": "to_tsvector('simple', coalesce(heading,'') || ' ' || content)",
            "type": "stored"
          }
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "chunks_source_idx": {
          "name": "chunks_source_idx",
          "columns": [
            {
              "expression": "source_type",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "source_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "chunks_tsv_idx": {
          "name": "chunks_tsv_idx",
          "columns": [
            {
              "expression": "tsv",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "gin",
          "with": {}
        },
        "chunks_unique": {
          "name": "chunks_unique",
          "columns": [
            {
              "expression": "source_type",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "source_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "ordinal",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "chunks_workspace_id_workspaces_id_fk": {
          "name": "chunks_workspace_id_workspaces_id_fk",
          "tableFrom": "chunks",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.dashboard_layouts": {
      "name": "dashboard_layouts",
      "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
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'Home'"
        },
        "widgets": {
          "name": "widgets",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'[]'::jsonb"
        },
        "is_default": {
          "name": "is_default",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "dashboard_layouts_user_id_users_id_fk": {
          "name": "dashboard_layouts_user_id_users_id_fk",
          "tableFrom": "dashboard_layouts",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.database_properties": {
      "name": "database_properties",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "database_id": {
          "name": "database_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
        },
        "config": {
          "name": "config",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "position": {
          "name": "position",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "width": {
          "name": "width",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 180
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "db_props_db_idx": {
          "name": "db_props_db_idx",
          "columns": [
            {
              "expression": "database_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "database_properties_database_id_databases_id_fk": {
          "name": "database_properties_database_id_databases_id_fk",
          "tableFrom": "database_properties",
          "tableTo": "databases",
          "columnsFrom": [
            "database_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.database_rows": {
      "name": "database_rows",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "database_id": {
          "name": "database_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "page_id": {
          "name": "page_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "values": {
          "name": "values",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "position": {
          "name": "position",
          "type": "double precision",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "deleted_at": {
          "name": "deleted_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "db_rows_db_idx": {
          "name": "db_rows_db_idx",
          "columns": [
            {
              "expression": "database_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "db_rows_values_idx": {
          "name": "db_rows_values_idx",
          "columns": [
            {
              "expression": "values",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "gin",
          "with": {}
        }
      },
      "foreignKeys": {
        "database_rows_database_id_databases_id_fk": {
          "name": "database_rows_database_id_databases_id_fk",
          "tableFrom": "database_rows",
          "tableTo": "databases",
          "columnsFrom": [
            "database_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "database_rows_page_id_pages_id_fk": {
          "name": "database_rows_page_id_pages_id_fk",
          "tableFrom": "database_rows",
          "tableTo": "pages",
          "columnsFrom": [
            "page_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.database_views": {
      "name": "database_views",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "database_id": {
          "name": "database_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,
          "default": "'table'"
        },
        "config": {
          "name": "config",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "position": {
          "name": "position",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "is_default": {
          "name": "is_default",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "database_views_database_id_databases_id_fk": {
          "name": "database_views_database_id_databases_id_fk",
          "tableFrom": "database_views",
          "tableTo": "databases",
          "columnsFrom": [
            "database_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.databases": {
      "name": "databases",
      "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
        },
        "page_id": {
          "name": "page_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "icon": {
          "name": "icon",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_template": {
          "name": "is_template",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "template_of": {
          "name": "template_of",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "deleted_at": {
          "name": "deleted_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "databases_workspace_id_workspaces_id_fk": {
          "name": "databases_workspace_id_workspaces_id_fk",
          "tableFrom": "databases",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "databases_page_id_pages_id_fk": {
          "name": "databases_page_id_pages_id_fk",
          "tableFrom": "databases",
          "tableTo": "pages",
          "columnsFrom": [
            "page_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.embeddings": {
      "name": "embeddings",
      "schema": "",
      "columns": {
        "chunk_id": {
          "name": "chunk_id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true
        },
        "model": {
          "name": "model",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "version": {
          "name": "version",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "embedding": {
          "name": "embedding",
          "type": "vector(1536)",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "embeddings_hnsw_idx": {
          "name": "embeddings_hnsw_idx",
          "columns": [
            {
              "expression": "\"embedding\" vector_cosine_ops",
              "asc": true,
              "isExpression": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "hnsw",
          "with": {}
        }
      },
      "foreignKeys": {
        "embeddings_chunk_id_chunks_id_fk": {
          "name": "embeddings_chunk_id_chunks_id_fk",
          "tableFrom": "embeddings",
          "tableTo": "chunks",
          "columnsFrom": [
            "chunk_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.experiments": {
      "name": "experiments",
      "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
        },
        "page_id": {
          "name": "page_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'planned'"
        },
        "params": {
          "name": "params",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "metrics": {
          "name": "metrics",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "dataset_ref": {
          "name": "dataset_ref",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "repo_url": {
          "name": "repo_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "started_at": {
          "name": "started_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "finished_at": {
          "name": "finished_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "experiments_workspace_id_workspaces_id_fk": {
          "name": "experiments_workspace_id_workspaces_id_fk",
          "tableFrom": "experiments",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "experiments_page_id_pages_id_fk": {
          "name": "experiments_page_id_pages_id_fk",
          "tableFrom": "experiments",
          "tableTo": "pages",
          "columnsFrom": [
            "page_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.index_state": {
      "name": "index_state",
      "schema": "",
      "columns": {
        "source_type": {
          "name": "source_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "source_id": {
          "name": "source_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "content_hash": {
          "name": "content_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "model": {
          "name": "model",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "version": {
          "name": "version",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "indexed_at": {
          "name": "indexed_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {
        "index_state_source_type_source_id_pk": {
          "name": "index_state_source_type_source_id_pk",
          "columns": [
            "source_type",
            "source_id"
          ]
        }
      },
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.knowledge_edges": {
      "name": "knowledge_edges",
      "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
        },
        "from_id": {
          "name": "from_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "to_id": {
          "name": "to_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "from_type": {
          "name": "from_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'page'"
        },
        "to_type": {
          "name": "to_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'page'"
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'accepted'"
        },
        "confidence": {
          "name": "confidence",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false
        },
        "rationale": {
          "name": "rationale",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "model": {
          "name": "model",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "decided_at": {
          "name": "decided_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "kedges_unique": {
          "name": "kedges_unique",
          "columns": [
            {
              "expression": "from_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "to_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "kind",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "kedges_ws_idx": {
          "name": "kedges_ws_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "knowledge_edges_workspace_id_workspaces_id_fk": {
          "name": "knowledge_edges_workspace_id_workspaces_id_fk",
          "tableFrom": "knowledge_edges",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.links": {
      "name": "links",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "from_page_id": {
          "name": "from_page_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "to_page_id": {
          "name": "to_page_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "kind": {
          "name": "kind",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'link'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "links_unique": {
          "name": "links_unique",
          "columns": [
            {
              "expression": "from_page_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "to_page_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "kind",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "links_to_idx": {
          "name": "links_to_idx",
          "columns": [
            {
              "expression": "to_page_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "links_from_page_id_pages_id_fk": {
          "name": "links_from_page_id_pages_id_fk",
          "tableFrom": "links",
          "tableTo": "pages",
          "columnsFrom": [
            "from_page_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "links_to_page_id_pages_id_fk": {
          "name": "links_to_page_id_pages_id_fk",
          "tableFrom": "links",
          "tableTo": "pages",
          "columnsFrom": [
            "to_page_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.login_attempts": {
      "name": "login_attempts",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "ip": {
          "name": "ip",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "username": {
          "name": "username",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "success": {
          "name": "success",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "login_attempts_ip_idx": {
          "name": "login_attempts_ip_idx",
          "columns": [
            {
              "expression": "ip",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "created_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.page_tags": {
      "name": "page_tags",
      "schema": "",
      "columns": {
        "page_id": {
          "name": "page_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "tag_id": {
          "name": "tag_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {},
      "foreignKeys": {
        "page_tags_page_id_pages_id_fk": {
          "name": "page_tags_page_id_pages_id_fk",
          "tableFrom": "page_tags",
          "tableTo": "pages",
          "columnsFrom": [
            "page_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "page_tags_tag_id_tags_id_fk": {
          "name": "page_tags_tag_id_tags_id_fk",
          "tableFrom": "page_tags",
          "tableTo": "tags",
          "columnsFrom": [
            "tag_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "page_tags_page_id_tag_id_pk": {
          "name": "page_tags_page_id_tag_id_pk",
          "columns": [
            "page_id",
            "tag_id"
          ]
        }
      },
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.page_versions": {
      "name": "page_versions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "page_id": {
          "name": "page_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "version": {
          "name": "version",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "content": {
          "name": "content",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "properties": {
          "name": "properties",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "reason": {
          "name": "reason",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'autosave'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "word_count": {
          "name": "word_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 0
        }
      },
      "indexes": {
        "page_versions_unique": {
          "name": "page_versions_unique",
          "columns": [
            {
              "expression": "page_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "version",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "page_versions_page_id_pages_id_fk": {
          "name": "page_versions_page_id_pages_id_fk",
          "tableFrom": "page_versions",
          "tableTo": "pages",
          "columnsFrom": [
            "page_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.pages": {
      "name": "pages",
      "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
        },
        "parent_id": {
          "name": "parent_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "database_id": {
          "name": "database_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'page'"
        },
        "section": {
          "name": "section",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'notes'"
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'Untitled'"
        },
        "icon": {
          "name": "icon",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "cover": {
          "name": "cover",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "content": {
          "name": "content",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{\"type\":\"doc\",\"content\":[]}'::jsonb"
        },
        "plain_text": {
          "name": "plain_text",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "tsv": {
          "name": "tsv",
          "type": "tsvector",
          "primaryKey": false,
          "notNull": false,
          "generated": {
            "as": "setweight(to_tsvector('simple', coalesce(title,'')), 'A') || setweight(to_tsvector('simple', coalesce(plain_text,'')), 'B')",
            "type": "stored"
          }
        },
        "properties": {
          "name": "properties",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'{}'::jsonb"
        },
        "position": {
          "name": "position",
          "type": "double precision",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "pinned": {
          "name": "pinned",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "archived": {
          "name": "archived",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "version": {
          "name": "version",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "word_count": {
          "name": "word_count",
          "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()"
        },
        "last_opened_at": {
          "name": "last_opened_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "deleted_at": {
          "name": "deleted_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "pages_ws_parent_idx": {
          "name": "pages_ws_parent_idx",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "parent_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "pages_tsv_idx": {
          "name": "pages_tsv_idx",
          "columns": [
            {
              "expression": "tsv",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "gin",
          "with": {}
        },
        "pages_updated_idx": {
          "name": "pages_updated_idx",
          "columns": [
            {
              "expression": "updated_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "pages_db_idx": {
          "name": "pages_db_idx",
          "columns": [
            {
              "expression": "database_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "pages_title_trgm_idx": {
          "name": "pages_title_trgm_idx",
          "columns": [
            {
              "expression": "\"title\" gin_trgm_ops",
              "asc": true,
              "isExpression": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "gin",
          "with": {}
        }
      },
      "foreignKeys": {
        "pages_workspace_id_workspaces_id_fk": {
          "name": "pages_workspace_id_workspaces_id_fk",
          "tableFrom": "pages",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.relations": {
      "name": "relations",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "property_id": {
          "name": "property_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "from_row_id": {
          "name": "from_row_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "to_row_id": {
          "name": "to_row_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "relations_unique": {
          "name": "relations_unique",
          "columns": [
            {
              "expression": "property_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "from_row_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "to_row_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "relations_to_idx": {
          "name": "relations_to_idx",
          "columns": [
            {
              "expression": "to_row_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "relations_property_id_database_properties_id_fk": {
          "name": "relations_property_id_database_properties_id_fk",
          "tableFrom": "relations",
          "tableTo": "database_properties",
          "columnsFrom": [
            "property_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "relations_from_row_id_database_rows_id_fk": {
          "name": "relations_from_row_id_database_rows_id_fk",
          "tableFrom": "relations",
          "tableTo": "database_rows",
          "columnsFrom": [
            "from_row_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "relations_to_row_id_database_rows_id_fk": {
          "name": "relations_to_row_id_database_rows_id_fk",
          "tableFrom": "relations",
          "tableTo": "database_rows",
          "columnsFrom": [
            "to_row_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.references": {
      "name": "references",
      "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
        },
        "page_id": {
          "name": "page_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "cite_key": {
          "name": "cite_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "entry_type": {
          "name": "entry_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'article'"
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "authors": {
          "name": "authors",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "year": {
          "name": "year",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "journal": {
          "name": "journal",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "doi": {
          "name": "doi",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "url": {
          "name": "url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "bibtex": {
          "name": "bibtex",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "fields": {
          "name": "fields",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "verified": {
          "name": "verified",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'user'"
        },
        "attachment_id": {
          "name": "attachment_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "deleted_at": {
          "name": "deleted_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "references_key_unique": {
          "name": "references_key_unique",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "cite_key",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "references_workspace_id_workspaces_id_fk": {
          "name": "references_workspace_id_workspaces_id_fk",
          "tableFrom": "references",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "references_page_id_pages_id_fk": {
          "name": "references_page_id_pages_id_fk",
          "tableFrom": "references",
          "tableTo": "pages",
          "columnsFrom": [
            "page_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "references_attachment_id_attachments_id_fk": {
          "name": "references_attachment_id_attachments_id_fk",
          "tableFrom": "references",
          "tableTo": "attachments",
          "columnsFrom": [
            "attachment_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "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
        },
        "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
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "last_seen_at": {
          "name": "last_seen_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        },
        "absolute_expires_at": {
          "name": "absolute_expires_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        },
        "revoked_at": {
          "name": "revoked_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "mfa_passed": {
          "name": "mfa_passed",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        }
      },
      "indexes": {
        "sessions_user_idx": {
          "name": "sessions_user_idx",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "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": {
        "sessions_token_hash_unique": {
          "name": "sessions_token_hash_unique",
          "nullsNotDistinct": false,
          "columns": [
            "token_hash"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.settings": {
      "name": "settings",
      "schema": "",
      "columns": {
        "key": {
          "name": "key",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "value": {
          "name": "value",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.tags": {
      "name": "tags",
      "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
        },
        "color": {
          "name": "color",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'gray'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "tags_unique": {
          "name": "tags_unique",
          "columns": [
            {
              "expression": "workspace_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "name",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "tags_workspace_id_workspaces_id_fk": {
          "name": "tags_workspace_id_workspaces_id_fk",
          "tableFrom": "tags",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.tasks": {
      "name": "tasks",
      "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
        },
        "page_id": {
          "name": "page_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'todo'"
        },
        "priority": {
          "name": "priority",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'medium'"
        },
        "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
        },
        "project": {
          "name": "project",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "deleted_at": {
          "name": "deleted_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "tasks_due_idx": {
          "name": "tasks_due_idx",
          "columns": [
            {
              "expression": "due_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "tasks_workspace_id_workspaces_id_fk": {
          "name": "tasks_workspace_id_workspaces_id_fk",
          "tableFrom": "tasks",
          "tableTo": "workspaces",
          "columnsFrom": [
            "workspace_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "tasks_page_id_pages_id_fk": {
          "name": "tasks_page_id_pages_id_fk",
          "tableFrom": "tasks",
          "tableTo": "pages",
          "columnsFrom": [
            "page_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.users": {
      "name": "users",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "username": {
          "name": "username",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "display_name": {
          "name": "display_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "password_hash": {
          "name": "password_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "totp_secret": {
          "name": "totp_secret",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "totp_enabled": {
          "name": "totp_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "preferences": {
          "name": "preferences",
          "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()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "users_username_unique": {
          "name": "users_username_unique",
          "nullsNotDistinct": false,
          "columns": [
            "username"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.webauthn_challenges": {
      "name": "webauthn_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": false
        },
        "challenge": {
          "name": "challenge",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "kind": {
          "name": "kind",
          "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.webauthn_credentials": {
      "name": "webauthn_credentials",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "public_key": {
          "name": "public_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "counter": {
          "name": "counter",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "transports": {
          "name": "transports",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "device_type": {
          "name": "device_type",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "backed_up": {
          "name": "backed_up",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "label": {
          "name": "label",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "last_used_at": {
          "name": "last_used_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "webauthn_credentials_user_id_users_id_fk": {
          "name": "webauthn_credentials_user_id_users_id_fk",
          "tableFrom": "webauthn_credentials",
          "tableTo": "users",
          "columnsFrom": [
            "user_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()"
        },
        "owner_id": {
          "name": "owner_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "slug": {
          "name": "slug",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "settings": {
          "name": "settings",
          "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()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "workspaces_owner_id_users_id_fk": {
          "name": "workspaces_owner_id_users_id_fk",
          "tableFrom": "workspaces",
          "tableTo": "users",
          "columnsFrom": [
            "owner_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "workspaces_slug_unique": {
          "name": "workspaces_slug_unique",
          "nullsNotDistinct": false,
          "columns": [
            "slug"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    }
  },
  "enums": {},
  "schemas": {},
  "sequences": {},
  "roles": {},
  "policies": {},
  "views": {},
  "_meta": {
    "columns": {},
    "schemas": {},
    "tables": {}
  }
}