{
  "version": "6",
  "dialect": "sqlite",
  "id": "105b4da9-7d69-4d03-9ccf-b099bb352292",
  "prevId": "5d72d904-e1ca-4832-a085-bbf3ee2a3a08",
  "tables": {
    "agent": {
      "name": "agent",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "''"
        },
        "instructions": {
          "name": "instructions",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "model": {
          "name": "model",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "plan_model": {
          "name": "plan_model",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "small_model": {
          "name": "small_model",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "disabled_tools": {
          "name": "disabled_tools",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'[]'"
        },
        "configuration": {
          "name": "configuration",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'{}'"
        },
        "order_key": {
          "name": "order_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "deleted_at": {
          "name": "deleted_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        }
      },
      "indexes": {
        "agent_name_idx": {
          "name": "agent_name_idx",
          "columns": ["name"],
          "isUnique": false
        },
        "agent_type_idx": {
          "name": "agent_type_idx",
          "columns": ["type"],
          "isUnique": false
        },
        "agent_order_key_idx": {
          "name": "agent_order_key_idx",
          "columns": ["order_key"],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "agent_model_user_model_id_fk": {
          "name": "agent_model_user_model_id_fk",
          "tableFrom": "agent",
          "tableTo": "user_model",
          "columnsFrom": ["model"],
          "columnsTo": ["id"],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "agent_plan_model_user_model_id_fk": {
          "name": "agent_plan_model_user_model_id_fk",
          "tableFrom": "agent",
          "tableTo": "user_model",
          "columnsFrom": ["plan_model"],
          "columnsTo": ["id"],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "agent_small_model_user_model_id_fk": {
          "name": "agent_small_model_user_model_id_fk",
          "tableFrom": "agent",
          "tableTo": "user_model",
          "columnsFrom": ["small_model"],
          "columnsTo": ["id"],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "agent_channel": {
      "name": "agent_channel",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "agent_id": {
          "name": "agent_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "session_id": {
          "name": "session_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "workspace": {
          "name": "workspace",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "config": {
          "name": "config",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "is_active": {
          "name": "is_active",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": true
        },
        "active_chat_ids": {
          "name": "active_chat_ids",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'[]'"
        },
        "permission_mode": {
          "name": "permission_mode",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "agent_channel_agent_id_idx": {
          "name": "agent_channel_agent_id_idx",
          "columns": ["agent_id"],
          "isUnique": false
        },
        "agent_channel_type_idx": {
          "name": "agent_channel_type_idx",
          "columns": ["type"],
          "isUnique": false
        },
        "agent_channel_session_id_idx": {
          "name": "agent_channel_session_id_idx",
          "columns": ["session_id"],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "agent_channel_agent_id_agent_id_fk": {
          "name": "agent_channel_agent_id_agent_id_fk",
          "tableFrom": "agent_channel",
          "tableTo": "agent",
          "columnsFrom": ["agent_id"],
          "columnsTo": ["id"],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "agent_channel_session_id_agent_session_id_fk": {
          "name": "agent_channel_session_id_agent_session_id_fk",
          "tableFrom": "agent_channel",
          "tableTo": "agent_session",
          "columnsFrom": ["session_id"],
          "columnsTo": ["id"],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {
        "agent_channel_type_check": {
          "name": "agent_channel_type_check",
          "value": "\"agent_channel\".\"type\" IN ('telegram', 'feishu', 'qq', 'wechat', 'discord', 'slack')"
        },
        "agent_channel_permission_mode_check": {
          "name": "agent_channel_permission_mode_check",
          "value": "\"agent_channel\".\"permission_mode\" IS NULL OR \"agent_channel\".\"permission_mode\" IN ('default', 'acceptEdits', 'bypassPermissions', 'plan')"
        }
      }
    },
    "agent_channel_task": {
      "name": "agent_channel_task",
      "columns": {
        "channel_id": {
          "name": "channel_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "task_id": {
          "name": "task_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "agent_channel_task_channel_id_idx": {
          "name": "agent_channel_task_channel_id_idx",
          "columns": ["channel_id"],
          "isUnique": false
        },
        "agent_channel_task_task_id_idx": {
          "name": "agent_channel_task_task_id_idx",
          "columns": ["task_id"],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "agent_channel_task_channel_id_agent_channel_id_fk": {
          "name": "agent_channel_task_channel_id_agent_channel_id_fk",
          "tableFrom": "agent_channel_task",
          "tableTo": "agent_channel",
          "columnsFrom": ["channel_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "agent_channel_task_task_id_job_schedule_id_fk": {
          "name": "agent_channel_task_task_id_job_schedule_id_fk",
          "tableFrom": "agent_channel_task",
          "tableTo": "job_schedule",
          "columnsFrom": ["task_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "agent_channel_task_channel_id_task_id_pk": {
          "columns": ["channel_id", "task_id"],
          "name": "agent_channel_task_channel_id_task_id_pk"
        }
      },
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "agent_global_skill": {
      "name": "agent_global_skill",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "folder_name": {
          "name": "folder_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "source": {
          "name": "source",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "source_url": {
          "name": "source_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "namespace": {
          "name": "namespace",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "author": {
          "name": "author",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "tags": {
          "name": "tags",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'[]'"
        },
        "content_hash": {
          "name": "content_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "is_enabled": {
          "name": "is_enabled",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "agent_global_skill_folder_name_unique": {
          "name": "agent_global_skill_folder_name_unique",
          "columns": ["folder_name"],
          "isUnique": true
        },
        "agent_global_skill_source_idx": {
          "name": "agent_global_skill_source_idx",
          "columns": ["source"],
          "isUnique": false
        },
        "agent_global_skill_is_enabled_idx": {
          "name": "agent_global_skill_is_enabled_idx",
          "columns": ["is_enabled"],
          "isUnique": false
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "agent_session": {
      "name": "agent_session",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "agent_id": {
          "name": "agent_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "is_name_manually_edited": {
          "name": "is_name_manually_edited",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": false
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "''"
        },
        "workspace_id": {
          "name": "workspace_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "trace_id": {
          "name": "trace_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "order_key": {
          "name": "order_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "agent_session_order_key_idx": {
          "name": "agent_session_order_key_idx",
          "columns": ["order_key"],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "agent_session_agent_id_agent_id_fk": {
          "name": "agent_session_agent_id_agent_id_fk",
          "tableFrom": "agent_session",
          "tableTo": "agent",
          "columnsFrom": ["agent_id"],
          "columnsTo": ["id"],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "agent_session_workspace_id_agent_workspace_id_fk": {
          "name": "agent_session_workspace_id_agent_workspace_id_fk",
          "tableFrom": "agent_session",
          "tableTo": "agent_workspace",
          "columnsFrom": ["workspace_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "agent_session_message": {
      "name": "agent_session_message",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "session_id": {
          "name": "session_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "role": {
          "name": "role",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "data": {
          "name": "data",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "searchable_text": {
          "name": "searchable_text",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "''"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "model_id": {
          "name": "model_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "model_snapshot": {
          "name": "model_snapshot",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "stats": {
          "name": "stats",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "runtime_resume_token": {
          "name": "runtime_resume_token",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "fts_rowid": {
          "name": "fts_rowid",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "agent_session_message_session_created_id_idx": {
          "name": "agent_session_message_session_created_id_idx",
          "columns": ["session_id", "created_at", "id"],
          "isUnique": false
        },
        "agent_session_message_status_idx": {
          "name": "agent_session_message_status_idx",
          "columns": ["status"],
          "isUnique": false
        },
        "agent_session_message_fts_rowid_uniq": {
          "name": "agent_session_message_fts_rowid_uniq",
          "columns": ["fts_rowid"],
          "isUnique": true
        }
      },
      "foreignKeys": {
        "agent_session_message_session_id_agent_session_id_fk": {
          "name": "agent_session_message_session_id_agent_session_id_fk",
          "tableFrom": "agent_session_message",
          "tableTo": "agent_session",
          "columnsFrom": ["session_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "agent_session_message_model_id_user_model_id_fk": {
          "name": "agent_session_message_model_id_user_model_id_fk",
          "tableFrom": "agent_session_message",
          "tableTo": "user_model",
          "columnsFrom": ["model_id"],
          "columnsTo": ["id"],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {
        "agent_session_message_role_check": {
          "name": "agent_session_message_role_check",
          "value": "\"agent_session_message\".\"role\" IN ('user', 'assistant', 'system')"
        },
        "agent_session_message_status_check": {
          "name": "agent_session_message_status_check",
          "value": "\"agent_session_message\".\"status\" IN ('pending', 'success', 'error', 'paused')"
        }
      }
    },
    "agent_skill": {
      "name": "agent_skill",
      "columns": {
        "agent_id": {
          "name": "agent_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "skill_id": {
          "name": "skill_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "is_enabled": {
          "name": "is_enabled",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "agent_skill_agent_id_idx": {
          "name": "agent_skill_agent_id_idx",
          "columns": ["agent_id"],
          "isUnique": false
        },
        "agent_skill_skill_id_idx": {
          "name": "agent_skill_skill_id_idx",
          "columns": ["skill_id"],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "agent_skill_agent_id_agent_id_fk": {
          "name": "agent_skill_agent_id_agent_id_fk",
          "tableFrom": "agent_skill",
          "tableTo": "agent",
          "columnsFrom": ["agent_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "agent_skill_skill_id_agent_global_skill_id_fk": {
          "name": "agent_skill_skill_id_agent_global_skill_id_fk",
          "tableFrom": "agent_skill",
          "tableTo": "agent_global_skill",
          "columnsFrom": ["skill_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "agent_skill_agent_id_skill_id_pk": {
          "columns": ["agent_id", "skill_id"],
          "name": "agent_skill_agent_id_skill_id_pk"
        }
      },
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "agent_workspace": {
      "name": "agent_workspace",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "path": {
          "name": "path",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'user'"
        },
        "order_key": {
          "name": "order_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "agent_workspace_path_unique_idx": {
          "name": "agent_workspace_path_unique_idx",
          "columns": ["path"],
          "isUnique": true
        },
        "agent_workspace_order_key_idx": {
          "name": "agent_workspace_order_key_idx",
          "columns": ["order_key"],
          "isUnique": false
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {
        "agent_workspace_type_check": {
          "name": "agent_workspace_type_check",
          "value": "\"agent_workspace\".\"type\" IN ('user', 'system')"
        }
      }
    },
    "app_state": {
      "name": "app_state",
      "columns": {
        "key": {
          "name": "key",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "value": {
          "name": "value",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "assistant": {
      "name": "assistant",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "prompt": {
          "name": "prompt",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "''"
        },
        "emoji": {
          "name": "emoji",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "''"
        },
        "model_id": {
          "name": "model_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "settings": {
          "name": "settings",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "order_key": {
          "name": "order_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "deleted_at": {
          "name": "deleted_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        }
      },
      "indexes": {
        "assistant_created_at_idx": {
          "name": "assistant_created_at_idx",
          "columns": ["created_at"],
          "isUnique": false
        },
        "assistant_order_key_idx": {
          "name": "assistant_order_key_idx",
          "columns": ["order_key"],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "assistant_model_id_user_model_id_fk": {
          "name": "assistant_model_id_user_model_id_fk",
          "tableFrom": "assistant",
          "tableTo": "user_model",
          "columnsFrom": ["model_id"],
          "columnsTo": ["id"],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "agent_mcp_server": {
      "name": "agent_mcp_server",
      "columns": {
        "agent_id": {
          "name": "agent_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "mcp_server_id": {
          "name": "mcp_server_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "agent_mcp_server_agent_id_agent_id_fk": {
          "name": "agent_mcp_server_agent_id_agent_id_fk",
          "tableFrom": "agent_mcp_server",
          "tableTo": "agent",
          "columnsFrom": ["agent_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "agent_mcp_server_mcp_server_id_mcp_server_id_fk": {
          "name": "agent_mcp_server_mcp_server_id_mcp_server_id_fk",
          "tableFrom": "agent_mcp_server",
          "tableTo": "mcp_server",
          "columnsFrom": ["mcp_server_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "agent_mcp_server_agent_id_mcp_server_id_pk": {
          "columns": ["agent_id", "mcp_server_id"],
          "name": "agent_mcp_server_agent_id_mcp_server_id_pk"
        }
      },
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "assistant_knowledge_base": {
      "name": "assistant_knowledge_base",
      "columns": {
        "assistant_id": {
          "name": "assistant_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "knowledge_base_id": {
          "name": "knowledge_base_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "assistant_knowledge_base_assistant_id_assistant_id_fk": {
          "name": "assistant_knowledge_base_assistant_id_assistant_id_fk",
          "tableFrom": "assistant_knowledge_base",
          "tableTo": "assistant",
          "columnsFrom": ["assistant_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "assistant_knowledge_base_knowledge_base_id_knowledge_base_id_fk": {
          "name": "assistant_knowledge_base_knowledge_base_id_knowledge_base_id_fk",
          "tableFrom": "assistant_knowledge_base",
          "tableTo": "knowledge_base",
          "columnsFrom": ["knowledge_base_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "assistant_knowledge_base_assistant_id_knowledge_base_id_pk": {
          "columns": ["assistant_id", "knowledge_base_id"],
          "name": "assistant_knowledge_base_assistant_id_knowledge_base_id_pk"
        }
      },
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "assistant_mcp_server": {
      "name": "assistant_mcp_server",
      "columns": {
        "assistant_id": {
          "name": "assistant_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "mcp_server_id": {
          "name": "mcp_server_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "assistant_mcp_server_assistant_id_assistant_id_fk": {
          "name": "assistant_mcp_server_assistant_id_assistant_id_fk",
          "tableFrom": "assistant_mcp_server",
          "tableTo": "assistant",
          "columnsFrom": ["assistant_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "assistant_mcp_server_mcp_server_id_mcp_server_id_fk": {
          "name": "assistant_mcp_server_mcp_server_id_mcp_server_id_fk",
          "tableFrom": "assistant_mcp_server",
          "tableTo": "mcp_server",
          "columnsFrom": ["mcp_server_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "assistant_mcp_server_assistant_id_mcp_server_id_pk": {
          "columns": ["assistant_id", "mcp_server_id"],
          "name": "assistant_mcp_server_assistant_id_mcp_server_id_pk"
        }
      },
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "file_entry": {
      "name": "file_entry",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "origin": {
          "name": "origin",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "ext": {
          "name": "ext",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "size": {
          "name": "size",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "external_path": {
          "name": "external_path",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "deleted_at": {
          "name": "deleted_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        }
      },
      "indexes": {
        "fe_deleted_at_idx": {
          "name": "fe_deleted_at_idx",
          "columns": ["deleted_at"],
          "isUnique": false
        },
        "fe_created_at_idx": {
          "name": "fe_created_at_idx",
          "columns": ["created_at"],
          "isUnique": false
        },
        "fe_external_path_lower_unique_idx": {
          "name": "fe_external_path_lower_unique_idx",
          "columns": ["lower(\"external_path\")"],
          "isUnique": true
        },
        "fe_external_path_idx": {
          "name": "fe_external_path_idx",
          "columns": ["external_path"],
          "isUnique": false
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {
        "fe_origin_check": {
          "name": "fe_origin_check",
          "value": "\"file_entry\".\"origin\" IN ('internal', 'external')"
        },
        "fe_origin_consistency": {
          "name": "fe_origin_consistency",
          "value": "(\"file_entry\".\"origin\" = 'internal' AND \"file_entry\".\"external_path\" IS NULL) OR (\"file_entry\".\"origin\" = 'external' AND \"file_entry\".\"external_path\" IS NOT NULL)"
        },
        "fe_external_no_delete": {
          "name": "fe_external_no_delete",
          "value": "\"file_entry\".\"origin\" != 'external' OR \"file_entry\".\"deleted_at\" IS NULL"
        },
        "fe_size_internal_only": {
          "name": "fe_size_internal_only",
          "value": "(\"file_entry\".\"origin\" = 'internal' AND \"file_entry\".\"size\" IS NOT NULL AND \"file_entry\".\"size\" >= 0) OR (\"file_entry\".\"origin\" = 'external' AND \"file_entry\".\"size\" IS NULL)"
        }
      }
    },
    "file_ref": {
      "name": "file_ref",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "file_entry_id": {
          "name": "file_entry_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "source_type": {
          "name": "source_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "source_id": {
          "name": "source_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "role": {
          "name": "role",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "file_ref_entry_id_idx": {
          "name": "file_ref_entry_id_idx",
          "columns": ["file_entry_id"],
          "isUnique": false
        },
        "file_ref_source_idx": {
          "name": "file_ref_source_idx",
          "columns": ["source_type", "source_id"],
          "isUnique": false
        },
        "file_ref_unique_idx": {
          "name": "file_ref_unique_idx",
          "columns": ["file_entry_id", "source_type", "source_id", "role"],
          "isUnique": true
        }
      },
      "foreignKeys": {
        "file_ref_file_entry_id_file_entry_id_fk": {
          "name": "file_ref_file_entry_id_file_entry_id_fk",
          "tableFrom": "file_ref",
          "tableTo": "file_entry",
          "columnsFrom": ["file_entry_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "group": {
      "name": "group",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "entity_type": {
          "name": "entity_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "order_key": {
          "name": "order_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "group_entity_type_order_key_idx": {
          "name": "group_entity_type_order_key_idx",
          "columns": ["entity_type", "order_key"],
          "isUnique": false
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "job_schedule": {
      "name": "job_schedule",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "''"
        },
        "trigger": {
          "name": "trigger",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "job_input_template": {
          "name": "job_input_template",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "enabled": {
          "name": "enabled",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": true
        },
        "next_run": {
          "name": "next_run",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "last_run": {
          "name": "last_run",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "catch_up_policy": {
          "name": "catch_up_policy",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "metadata": {
          "name": "metadata",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'{}'"
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "job_schedule_type_name_uq": {
          "name": "job_schedule_type_name_uq",
          "columns": ["type", "name"],
          "isUnique": true
        },
        "job_schedule_enabled_next_run_idx": {
          "name": "job_schedule_enabled_next_run_idx",
          "columns": ["enabled", "next_run"],
          "isUnique": false
        },
        "job_schedule_type_idx": {
          "name": "job_schedule_type_idx",
          "columns": ["type"],
          "isUnique": false
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "job": {
      "name": "job",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "priority": {
          "name": "priority",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "queue": {
          "name": "queue",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "idempotency_key": {
          "name": "idempotency_key",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "schedule_id": {
          "name": "schedule_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "scheduled_at": {
          "name": "scheduled_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "started_at": {
          "name": "started_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "finished_at": {
          "name": "finished_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "attempt": {
          "name": "attempt",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "max_attempts": {
          "name": "max_attempts",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 3
        },
        "input": {
          "name": "input",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "output": {
          "name": "output",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "error": {
          "name": "error",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "parent_id": {
          "name": "parent_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "cancel_requested": {
          "name": "cancel_requested",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": false
        },
        "metadata": {
          "name": "metadata",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'{}'"
        },
        "timeout_ms": {
          "name": "timeout_ms",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "job_queue_status_scheduled_at_idx": {
          "name": "job_queue_status_scheduled_at_idx",
          "columns": ["queue", "status", "scheduled_at"],
          "isUnique": false
        },
        "job_status_idx": {
          "name": "job_status_idx",
          "columns": ["status"],
          "isUnique": false
        },
        "job_schedule_id_finished_at_idx": {
          "name": "job_schedule_id_finished_at_idx",
          "columns": ["schedule_id", "finished_at"],
          "isUnique": false
        },
        "job_parent_id_idx": {
          "name": "job_parent_id_idx",
          "columns": ["parent_id"],
          "isUnique": false
        },
        "job_idempotency_key_partial_uq": {
          "name": "job_idempotency_key_partial_uq",
          "columns": ["idempotency_key"],
          "isUnique": true,
          "where": "\"job\".\"idempotency_key\" IS NOT NULL AND \"job\".\"status\" NOT IN ('completed','failed','cancelled')"
        }
      },
      "foreignKeys": {
        "job_schedule_id_job_schedule_id_fk": {
          "name": "job_schedule_id_job_schedule_id_fk",
          "tableFrom": "job",
          "tableTo": "job_schedule",
          "columnsFrom": ["schedule_id"],
          "columnsTo": ["id"],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "job_parent_id_job_id_fk": {
          "name": "job_parent_id_job_id_fk",
          "tableFrom": "job",
          "tableTo": "job",
          "columnsFrom": ["parent_id"],
          "columnsTo": ["id"],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {
        "job_status_check": {
          "name": "job_status_check",
          "value": "\"job\".\"status\" IN ('pending','delayed','running','completed','failed','cancelled')"
        }
      }
    },
    "knowledge_base": {
      "name": "knowledge_base",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "group_id": {
          "name": "group_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "dimensions": {
          "name": "dimensions",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "embedding_model_id": {
          "name": "embedding_model_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "error": {
          "name": "error",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "rerank_model_id": {
          "name": "rerank_model_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "file_processor_id": {
          "name": "file_processor_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "chunk_size": {
          "name": "chunk_size",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "chunk_overlap": {
          "name": "chunk_overlap",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "chunk_strategy": {
          "name": "chunk_strategy",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'structured'"
        },
        "chunk_separator": {
          "name": "chunk_separator",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'\\n\\n'"
        },
        "threshold": {
          "name": "threshold",
          "type": "real",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "document_count": {
          "name": "document_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "search_mode": {
          "name": "search_mode",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "hybrid_alpha": {
          "name": "hybrid_alpha",
          "type": "real",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "knowledge_base_group_id_group_id_fk": {
          "name": "knowledge_base_group_id_group_id_fk",
          "tableFrom": "knowledge_base",
          "tableTo": "group",
          "columnsFrom": ["group_id"],
          "columnsTo": ["id"],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "knowledge_base_embedding_model_id_user_model_id_fk": {
          "name": "knowledge_base_embedding_model_id_user_model_id_fk",
          "tableFrom": "knowledge_base",
          "tableTo": "user_model",
          "columnsFrom": ["embedding_model_id"],
          "columnsTo": ["id"],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "knowledge_base_rerank_model_id_user_model_id_fk": {
          "name": "knowledge_base_rerank_model_id_user_model_id_fk",
          "tableFrom": "knowledge_base",
          "tableTo": "user_model",
          "columnsFrom": ["rerank_model_id"],
          "columnsTo": ["id"],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {
        "knowledge_base_search_mode_check": {
          "name": "knowledge_base_search_mode_check",
          "value": "\"knowledge_base\".\"search_mode\" IN ('vector', 'bm25', 'hybrid')"
        },
        "knowledge_base_chunk_strategy_check": {
          "name": "knowledge_base_chunk_strategy_check",
          "value": "\"knowledge_base\".\"chunk_strategy\" IN ('structured', 'delimiter')"
        },
        "knowledge_base_status_check": {
          "name": "knowledge_base_status_check",
          "value": "\"knowledge_base\".\"status\" IN ('completed', 'failed')"
        },
        "knowledge_base_status_error_check": {
          "name": "knowledge_base_status_error_check",
          "value": "\n        (\n          \"knowledge_base\".\"status\" = 'completed'\n          AND \"knowledge_base\".\"embedding_model_id\" IS NOT NULL\n          AND \"knowledge_base\".\"dimensions\" IS NOT NULL\n          AND \"knowledge_base\".\"dimensions\" > 0\n          AND \"knowledge_base\".\"error\" IS NULL\n        )\n        OR (\n          \"knowledge_base\".\"status\" = 'failed'\n          AND \"knowledge_base\".\"error\" IS NOT NULL\n          AND length(trim(\"knowledge_base\".\"error\")) > 0\n        )\n      "
        }
      }
    },
    "knowledge_item": {
      "name": "knowledge_item",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "base_id": {
          "name": "base_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "group_id": {
          "name": "group_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "data": {
          "name": "data",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "error": {
          "name": "error",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "knowledge_item_base_type_created_idx": {
          "name": "knowledge_item_base_type_created_idx",
          "columns": ["base_id", "type", "created_at"],
          "isUnique": false
        },
        "knowledge_item_base_group_created_idx": {
          "name": "knowledge_item_base_group_created_idx",
          "columns": ["base_id", "group_id", "created_at"],
          "isUnique": false
        },
        "knowledge_item_baseId_id_unique": {
          "name": "knowledge_item_baseId_id_unique",
          "columns": ["base_id", "id"],
          "isUnique": true
        }
      },
      "foreignKeys": {
        "knowledge_item_base_id_knowledge_base_id_fk": {
          "name": "knowledge_item_base_id_knowledge_base_id_fk",
          "tableFrom": "knowledge_item",
          "tableTo": "knowledge_base",
          "columnsFrom": ["base_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "knowledge_item_base_id_group_id_knowledge_item_base_id_id_fk": {
          "name": "knowledge_item_base_id_group_id_knowledge_item_base_id_id_fk",
          "tableFrom": "knowledge_item",
          "tableTo": "knowledge_item",
          "columnsFrom": ["base_id", "group_id"],
          "columnsTo": ["base_id", "id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {
        "knowledge_item_type_check": {
          "name": "knowledge_item_type_check",
          "value": "\"knowledge_item\".\"type\" IN ('file', 'url', 'note', 'directory')"
        },
        "knowledge_item_status_check": {
          "name": "knowledge_item_status_check",
          "value": "\"knowledge_item\".\"status\" IN ('idle', 'preparing', 'processing', 'reading', 'embedding', 'completed', 'failed', 'deleting')"
        },
        "knowledge_item_type_status_check": {
          "name": "knowledge_item_type_status_check",
          "value": "\n        (\"knowledge_item\".\"type\" IN ('file', 'url', 'note') AND \"knowledge_item\".\"status\" IN ('idle', 'processing', 'reading', 'embedding', 'completed', 'failed', 'deleting'))\n        OR (\"knowledge_item\".\"type\" = 'directory' AND \"knowledge_item\".\"status\" IN ('idle', 'preparing', 'processing', 'completed', 'failed', 'deleting'))\n      "
        },
        "knowledge_item_status_error_check": {
          "name": "knowledge_item_status_error_check",
          "value": "\n        (\n          \"knowledge_item\".\"status\" IN ('idle', 'preparing', 'processing', 'reading', 'embedding', 'completed', 'deleting')\n          AND \"knowledge_item\".\"error\" IS NULL\n        )\n        OR (\n          \"knowledge_item\".\"status\" = 'failed'\n          AND \"knowledge_item\".\"error\" IS NOT NULL\n          AND length(trim(\"knowledge_item\".\"error\")) > 0\n        )\n      "
        }
      }
    },
    "mcp_server": {
      "name": "mcp_server",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "base_url": {
          "name": "base_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "command": {
          "name": "command",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "registry_url": {
          "name": "registry_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "args": {
          "name": "args",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "env": {
          "name": "env",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "headers": {
          "name": "headers",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "provider": {
          "name": "provider",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "provider_url": {
          "name": "provider_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "logo_url": {
          "name": "logo_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "tags": {
          "name": "tags",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "long_running": {
          "name": "long_running",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "timeout": {
          "name": "timeout",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "dxt_version": {
          "name": "dxt_version",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "dxt_path": {
          "name": "dxt_path",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "reference": {
          "name": "reference",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "search_key": {
          "name": "search_key",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "config_sample": {
          "name": "config_sample",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "disabled_tools": {
          "name": "disabled_tools",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "disabled_auto_approve_tools": {
          "name": "disabled_auto_approve_tools",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "should_config": {
          "name": "should_config",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "sort_order": {
          "name": "sort_order",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false,
          "default": 0
        },
        "is_active": {
          "name": "is_active",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": false
        },
        "install_source": {
          "name": "install_source",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "is_trusted": {
          "name": "is_trusted",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "trusted_at": {
          "name": "trusted_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "installed_at": {
          "name": "installed_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "mcp_server_name_idx": {
          "name": "mcp_server_name_idx",
          "columns": ["name"],
          "isUnique": false
        },
        "mcp_server_is_active_idx": {
          "name": "mcp_server_is_active_idx",
          "columns": ["is_active"],
          "isUnique": false
        },
        "mcp_server_sort_order_idx": {
          "name": "mcp_server_sort_order_idx",
          "columns": ["sort_order"],
          "isUnique": false
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {
        "mcp_server_type_check": {
          "name": "mcp_server_type_check",
          "value": "\"mcp_server\".\"type\" IS NULL OR \"mcp_server\".\"type\" IN ('stdio', 'sse', 'streamableHttp', 'inMemory')"
        },
        "mcp_server_install_source_check": {
          "name": "mcp_server_install_source_check",
          "value": "\"mcp_server\".\"install_source\" IS NULL OR \"mcp_server\".\"install_source\" IN ('builtin', 'manual', 'protocol', 'unknown')"
        }
      }
    },
    "message": {
      "name": "message",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "parent_id": {
          "name": "parent_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "topic_id": {
          "name": "topic_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "role": {
          "name": "role",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "data": {
          "name": "data",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "searchable_text": {
          "name": "searchable_text",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "''"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "siblings_group_id": {
          "name": "siblings_group_id",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "model_id": {
          "name": "model_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "model_snapshot": {
          "name": "model_snapshot",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "stats": {
          "name": "stats",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "fts_rowid": {
          "name": "fts_rowid",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "deleted_at": {
          "name": "deleted_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        }
      },
      "indexes": {
        "message_parent_id_idx": {
          "name": "message_parent_id_idx",
          "columns": ["parent_id"],
          "isUnique": false
        },
        "message_topic_created_idx": {
          "name": "message_topic_created_idx",
          "columns": ["topic_id", "created_at"],
          "isUnique": false
        },
        "message_status_idx": {
          "name": "message_status_idx",
          "columns": ["status"],
          "isUnique": false
        },
        "message_topic_root_uniq": {
          "name": "message_topic_root_uniq",
          "columns": ["topic_id"],
          "isUnique": true,
          "where": "\"message\".\"parent_id\" is null and \"message\".\"deleted_at\" is null"
        },
        "message_fts_rowid_uniq": {
          "name": "message_fts_rowid_uniq",
          "columns": ["fts_rowid"],
          "isUnique": true
        }
      },
      "foreignKeys": {
        "message_topic_id_topic_id_fk": {
          "name": "message_topic_id_topic_id_fk",
          "tableFrom": "message",
          "tableTo": "topic",
          "columnsFrom": ["topic_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "message_model_id_user_model_id_fk": {
          "name": "message_model_id_user_model_id_fk",
          "tableFrom": "message",
          "tableTo": "user_model",
          "columnsFrom": ["model_id"],
          "columnsTo": ["id"],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "message_parent_id_message_id_fk": {
          "name": "message_parent_id_message_id_fk",
          "tableFrom": "message",
          "tableTo": "message",
          "columnsFrom": ["parent_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {
        "message_role_check": {
          "name": "message_role_check",
          "value": "\"message\".\"role\" IN ('user', 'assistant', 'system', 'root')"
        },
        "message_status_check": {
          "name": "message_status_check",
          "value": "\"message\".\"status\" IN ('pending', 'success', 'error', 'paused')"
        },
        "message_root_parent_check": {
          "name": "message_root_parent_check",
          "value": "(\"message\".\"role\" = 'root') = (\"message\".\"parent_id\" is null)"
        }
      }
    },
    "mini_app": {
      "name": "mini_app",
      "columns": {
        "app_id": {
          "name": "app_id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "preset_mini_app_id": {
          "name": "preset_mini_app_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "url": {
          "name": "url",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "logo": {
          "name": "logo",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'enabled'"
        },
        "order_key": {
          "name": "order_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "bordered": {
          "name": "bordered",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": true
        },
        "background": {
          "name": "background",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "supported_regions": {
          "name": "supported_regions",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "configuration": {
          "name": "configuration",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "name_key": {
          "name": "name_key",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "mini_app_status_order_key_idx": {
          "name": "mini_app_status_order_key_idx",
          "columns": ["status", "order_key"],
          "isUnique": false
        },
        "mini_app_preset_mini_app_id_idx": {
          "name": "mini_app_preset_mini_app_id_idx",
          "columns": ["preset_mini_app_id"],
          "isUnique": false
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {
        "mini_app_status_check": {
          "name": "mini_app_status_check",
          "value": "\"mini_app\".\"status\" IN ('enabled', 'disabled', 'pinned')"
        }
      }
    },
    "note": {
      "name": "note",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "root_path": {
          "name": "root_path",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "path": {
          "name": "path",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "is_starred": {
          "name": "is_starred",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": false
        },
        "is_expanded": {
          "name": "is_expanded",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "note_root_path_path_unique_idx": {
          "name": "note_root_path_path_unique_idx",
          "columns": ["root_path", "path"],
          "isUnique": true
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {
        "note_has_state_check": {
          "name": "note_has_state_check",
          "value": "\"note\".\"is_starred\" = 1 OR \"note\".\"is_expanded\" = 1"
        }
      }
    },
    "painting": {
      "name": "painting",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "provider_id": {
          "name": "provider_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "model_id": {
          "name": "model_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "prompt": {
          "name": "prompt",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "order_key": {
          "name": "order_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "painting_order_key_idx": {
          "name": "painting_order_key_idx",
          "columns": ["order_key"],
          "isUnique": false
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "pin": {
      "name": "pin",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "entity_type": {
          "name": "entity_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "entity_id": {
          "name": "entity_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "order_key": {
          "name": "order_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "pin_entity_type_entity_id_unique_idx": {
          "name": "pin_entity_type_entity_id_unique_idx",
          "columns": ["entity_type", "entity_id"],
          "isUnique": true
        },
        "pin_entity_type_order_key_idx": {
          "name": "pin_entity_type_order_key_idx",
          "columns": ["entity_type", "order_key"],
          "isUnique": false
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "preference": {
      "name": "preference",
      "columns": {
        "scope": {
          "name": "scope",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'default'"
        },
        "key": {
          "name": "key",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "value": {
          "name": "value",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {
        "preference_scope_key_pk": {
          "columns": ["scope", "key"],
          "name": "preference_scope_key_pk"
        }
      },
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "prompt": {
      "name": "prompt",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "content": {
          "name": "content",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "order_key": {
          "name": "order_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "prompt_order_key_idx": {
          "name": "prompt_order_key_idx",
          "columns": ["order_key"],
          "isUnique": false
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "entity_tag": {
      "name": "entity_tag",
      "columns": {
        "entity_type": {
          "name": "entity_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "entity_id": {
          "name": "entity_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "tag_id": {
          "name": "tag_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "entity_tag_tag_id_idx": {
          "name": "entity_tag_tag_id_idx",
          "columns": ["tag_id"],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "entity_tag_tag_id_tag_id_fk": {
          "name": "entity_tag_tag_id_tag_id_fk",
          "tableFrom": "entity_tag",
          "tableTo": "tag",
          "columnsFrom": ["tag_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "entity_tag_entity_type_entity_id_tag_id_pk": {
          "columns": ["entity_type", "entity_id", "tag_id"],
          "name": "entity_tag_entity_type_entity_id_tag_id_pk"
        }
      },
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "tag": {
      "name": "tag",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "color": {
          "name": "color",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "tag_name_unique": {
          "name": "tag_name_unique",
          "columns": ["name"],
          "isUnique": true
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "topic": {
      "name": "topic",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "''"
        },
        "is_name_manually_edited": {
          "name": "is_name_manually_edited",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": false
        },
        "assistant_id": {
          "name": "assistant_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "active_node_id": {
          "name": "active_node_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "group_id": {
          "name": "group_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "trace_id": {
          "name": "trace_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "order_key": {
          "name": "order_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "deleted_at": {
          "name": "deleted_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        }
      },
      "indexes": {
        "topic_group_updated_idx": {
          "name": "topic_group_updated_idx",
          "columns": ["group_id", "updated_at"],
          "isUnique": false
        },
        "topic_updated_at_idx": {
          "name": "topic_updated_at_idx",
          "columns": ["updated_at"],
          "isUnique": false
        },
        "topic_order_key_idx": {
          "name": "topic_order_key_idx",
          "columns": ["order_key"],
          "isUnique": false
        },
        "topic_assistant_id_idx": {
          "name": "topic_assistant_id_idx",
          "columns": ["assistant_id"],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "topic_assistant_id_assistant_id_fk": {
          "name": "topic_assistant_id_assistant_id_fk",
          "tableFrom": "topic",
          "tableTo": "assistant",
          "columnsFrom": ["assistant_id"],
          "columnsTo": ["id"],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "topic_group_id_group_id_fk": {
          "name": "topic_group_id_group_id_fk",
          "tableFrom": "topic",
          "tableTo": "group",
          "columnsFrom": ["group_id"],
          "columnsTo": ["id"],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "translate_history": {
      "name": "translate_history",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "source_text": {
          "name": "source_text",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "target_text": {
          "name": "target_text",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "source_language": {
          "name": "source_language",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "target_language": {
          "name": "target_language",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "star": {
          "name": "star",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "translate_history_created_at_idx": {
          "name": "translate_history_created_at_idx",
          "columns": ["created_at"],
          "isUnique": false
        },
        "translate_history_star_created_at_idx": {
          "name": "translate_history_star_created_at_idx",
          "columns": ["star", "created_at"],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "translate_history_source_language_translate_language_lang_code_fk": {
          "name": "translate_history_source_language_translate_language_lang_code_fk",
          "tableFrom": "translate_history",
          "tableTo": "translate_language",
          "columnsFrom": ["source_language"],
          "columnsTo": ["lang_code"],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "translate_history_target_language_translate_language_lang_code_fk": {
          "name": "translate_history_target_language_translate_language_lang_code_fk",
          "tableFrom": "translate_history",
          "tableTo": "translate_language",
          "columnsFrom": ["target_language"],
          "columnsTo": ["lang_code"],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "translate_language": {
      "name": "translate_language",
      "columns": {
        "lang_code": {
          "name": "lang_code",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "value": {
          "name": "value",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "emoji": {
          "name": "emoji",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "user_model": {
      "name": "user_model",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "provider_id": {
          "name": "provider_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "model_id": {
          "name": "model_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "preset_model_id": {
          "name": "preset_model_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "group": {
          "name": "group",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "capabilities": {
          "name": "capabilities",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "input_modalities": {
          "name": "input_modalities",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "output_modalities": {
          "name": "output_modalities",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "endpoint_types": {
          "name": "endpoint_types",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "custom_endpoint_url": {
          "name": "custom_endpoint_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "context_window": {
          "name": "context_window",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "max_input_tokens": {
          "name": "max_input_tokens",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "max_output_tokens": {
          "name": "max_output_tokens",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "supports_streaming": {
          "name": "supports_streaming",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": true
        },
        "reasoning": {
          "name": "reasoning",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "parameters": {
          "name": "parameters",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "pricing": {
          "name": "pricing",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "is_enabled": {
          "name": "is_enabled",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": true
        },
        "is_hidden": {
          "name": "is_hidden",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": false
        },
        "is_deprecated": {
          "name": "is_deprecated",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": false
        },
        "order_key": {
          "name": "order_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "user_overrides": {
          "name": "user_overrides",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "user_model_preset_idx": {
          "name": "user_model_preset_idx",
          "columns": ["preset_model_id"],
          "isUnique": false
        },
        "user_model_provider_enabled_idx": {
          "name": "user_model_provider_enabled_idx",
          "columns": ["provider_id", "is_enabled"],
          "isUnique": false
        },
        "user_model_provider_id_order_key_idx": {
          "name": "user_model_provider_id_order_key_idx",
          "columns": ["provider_id", "order_key"],
          "isUnique": false
        },
        "user_model_provider_model_unique": {
          "name": "user_model_provider_model_unique",
          "columns": ["provider_id", "model_id"],
          "isUnique": true
        }
      },
      "foreignKeys": {
        "user_model_provider_id_user_provider_provider_id_fk": {
          "name": "user_model_provider_id_user_provider_provider_id_fk",
          "tableFrom": "user_model",
          "tableTo": "user_provider",
          "columnsFrom": ["provider_id"],
          "columnsTo": ["provider_id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    },
    "user_provider": {
      "name": "user_provider",
      "columns": {
        "provider_id": {
          "name": "provider_id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "autoincrement": false
        },
        "preset_provider_id": {
          "name": "preset_provider_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "endpoint_configs": {
          "name": "endpoint_configs",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "default_chat_endpoint": {
          "name": "default_chat_endpoint",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "api_keys": {
          "name": "api_keys",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false,
          "default": "'[]'"
        },
        "auth_config": {
          "name": "auth_config",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "api_features": {
          "name": "api_features",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "provider_settings": {
          "name": "provider_settings",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "is_enabled": {
          "name": "is_enabled",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": false
        },
        "order_key": {
          "name": "order_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "user_provider_preset_idx": {
          "name": "user_provider_preset_idx",
          "columns": ["preset_provider_id"],
          "isUnique": false
        },
        "user_provider_enabled_idx": {
          "name": "user_provider_enabled_idx",
          "columns": ["is_enabled"],
          "isUnique": false
        },
        "user_provider_order_key_idx": {
          "name": "user_provider_order_key_idx",
          "columns": ["order_key"],
          "isUnique": false
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "checkConstraints": {}
    }
  },
  "views": {},
  "enums": {},
  "_meta": {
    "schemas": {},
    "tables": {},
    "columns": {}
  },
  "internal": {
    "indexes": {
      "fe_external_path_lower_unique_idx": {
        "columns": {
          "lower(\"external_path\")": {
            "isExpression": true
          }
        }
      }
    }
  }
}
