{ "id": "bb116673-684b-45bd-b89a-48f4161b5db9", "prevId": "b85372bf-b7dc-4bf7-9316-43435b5a4df6", "version": "7", "dialect": "postgresql", "tables": { "public.assistant_categories": { "name": "assistant_categories", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "name": { "name": "name", "type": "varchar(50)", "primaryKey": false, "notNull": true }, "icon": { "name": "icon", "type": "varchar(50)", "primaryKey": false, "notNull": false }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "sort_order": { "name": "sort_order", "type": "integer", "primaryKey": false, "notNull": false, "default": 0 }, "is_enabled": { "name": "is_enabled", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.assistants": { "name": "assistants", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "category_id": { "name": "category_id", "type": "integer", "primaryKey": false, "notNull": false }, "user_id": { "name": "user_id", "type": "varchar(64)", "primaryKey": false, "notNull": false }, "name": { "name": "name", "type": "varchar(100)", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "icon": { "name": "icon", "type": "varchar(100)", "primaryKey": false, "notNull": false }, "system_prompt": { "name": "system_prompt", "type": "text", "primaryKey": false, "notNull": true }, "tags": { "name": "tags", "type": "jsonb", "primaryKey": false, "notNull": false, "default": "'[]'::jsonb" }, "is_builtin": { "name": "is_builtin", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "is_enabled": { "name": "is_enabled", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "sort_order": { "name": "sort_order", "type": "integer", "primaryKey": false, "notNull": false, "default": 0 }, "use_count": { "name": "use_count", "type": "integer", "primaryKey": false, "notNull": false, "default": 0 }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.conversations": { "name": "conversations", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "conversation_id": { "name": "conversation_id", "type": "varchar(64)", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "varchar(64)", "primaryKey": false, "notNull": false }, "assistant_id": { "name": "assistant_id", "type": "integer", "primaryKey": false, "notNull": false }, "title": { "name": "title", "type": "varchar(255)", "primaryKey": false, "notNull": true, "default": "'新对话'" }, "summary": { "name": "summary", "type": "text", "primaryKey": false, "notNull": false }, "model": { "name": "model", "type": "varchar(64)", "primaryKey": false, "notNull": true }, "tools": { "name": "tools", "type": "jsonb", "primaryKey": false, "notNull": false, "default": "'[]'::jsonb" }, "enable_thinking": { "name": "enable_thinking", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "system_prompt": { "name": "system_prompt", "type": "text", "primaryKey": false, "notNull": false }, "temperature": { "name": "temperature", "type": "varchar(10)", "primaryKey": false, "notNull": false }, "message_count": { "name": "message_count", "type": "integer", "primaryKey": false, "notNull": false, "default": 0 }, "total_tokens": { "name": "total_tokens", "type": "integer", "primaryKey": false, "notNull": false, "default": 0 }, "is_archived": { "name": "is_archived", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "is_pinned": { "name": "is_pinned", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "tags": { "name": "tags", "type": "jsonb", "primaryKey": false, "notNull": false, "default": "'[]'::jsonb" }, "auto_tagged_at": { "name": "auto_tagged_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "last_message_at": { "name": "last_message_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "conversations_conversation_id_unique": { "name": "conversations_conversation_id_unique", "nullsNotDistinct": false, "columns": [ "conversation_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.messages": { "name": "messages", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "message_id": { "name": "message_id", "type": "varchar(64)", "primaryKey": false, "notNull": true }, "conversation_id": { "name": "conversation_id", "type": "varchar(64)", "primaryKey": false, "notNull": true }, "role": { "name": "role", "type": "varchar(20)", "primaryKey": false, "notNull": true }, "content": { "name": "content", "type": "text", "primaryKey": false, "notNull": true }, "thinking_content": { "name": "thinking_content", "type": "text", "primaryKey": false, "notNull": false }, "thinking_collapsed": { "name": "thinking_collapsed", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "tool_calls": { "name": "tool_calls", "type": "jsonb", "primaryKey": false, "notNull": false }, "tool_results": { "name": "tool_results", "type": "jsonb", "primaryKey": false, "notNull": false }, "images": { "name": "images", "type": "jsonb", "primaryKey": false, "notNull": false }, "uploaded_images": { "name": "uploaded_images", "type": "jsonb", "primaryKey": false, "notNull": false }, "uploaded_documents": { "name": "uploaded_documents", "type": "jsonb", "primaryKey": false, "notNull": false }, "used_tools": { "name": "used_tools", "type": "jsonb", "primaryKey": false, "notNull": false, "default": "'[]'::jsonb" }, "search_images": { "name": "search_images", "type": "jsonb", "primaryKey": false, "notNull": false }, "generated_images": { "name": "generated_images", "type": "jsonb", "primaryKey": false, "notNull": false }, "input_tokens": { "name": "input_tokens", "type": "integer", "primaryKey": false, "notNull": false, "default": 0 }, "output_tokens": { "name": "output_tokens", "type": "integer", "primaryKey": false, "notNull": false, "default": 0 }, "status": { "name": "status", "type": "varchar(20)", "primaryKey": false, "notNull": false, "default": "'completed'" }, "error_message": { "name": "error_message", "type": "text", "primaryKey": false, "notNull": false }, "feedback": { "name": "feedback", "type": "varchar(10)", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "messages_message_id_unique": { "name": "messages_message_id_unique", "nullsNotDistinct": false, "columns": [ "message_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.models": { "name": "models", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "model_id": { "name": "model_id", "type": "varchar(128)", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "varchar(64)", "primaryKey": false, "notNull": true }, "display_name": { "name": "display_name", "type": "varchar(128)", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "model_type": { "name": "model_type", "type": "varchar(20)", "primaryKey": false, "notNull": true, "default": "'claude'" }, "supports_tools": { "name": "supports_tools", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "supports_thinking": { "name": "supports_thinking", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "supports_vision": { "name": "supports_vision", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "max_tokens": { "name": "max_tokens", "type": "integer", "primaryKey": false, "notNull": false, "default": 8192 }, "context_window": { "name": "context_window", "type": "integer", "primaryKey": false, "notNull": false, "default": 200000 }, "is_enabled": { "name": "is_enabled", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "is_default": { "name": "is_default", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "sort_order": { "name": "sort_order", "type": "integer", "primaryKey": false, "notNull": false, "default": 0 }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "models_model_id_unique": { "name": "models_model_id_unique", "nullsNotDistinct": false, "columns": [ "model_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.notes": { "name": "notes", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "note_id": { "name": "note_id", "type": "varchar(64)", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "varchar(64)", "primaryKey": false, "notNull": true }, "conversation_id": { "name": "conversation_id", "type": "varchar(64)", "primaryKey": false, "notNull": false }, "message_id": { "name": "message_id", "type": "varchar(64)", "primaryKey": false, "notNull": false }, "title": { "name": "title", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "content": { "name": "content", "type": "text", "primaryKey": false, "notNull": true }, "tags": { "name": "tags", "type": "jsonb", "primaryKey": false, "notNull": false, "default": "'[]'::jsonb" }, "is_pinned": { "name": "is_pinned", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "is_archived": { "name": "is_archived", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "notes_note_id_unique": { "name": "notes_note_id_unique", "nullsNotDistinct": false, "columns": [ "note_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.prompt_optimizations": { "name": "prompt_optimizations", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "user_id": { "name": "user_id", "type": "varchar(64)", "primaryKey": false, "notNull": true }, "original_prompt": { "name": "original_prompt", "type": "text", "primaryKey": false, "notNull": true }, "optimized_prompt": { "name": "optimized_prompt", "type": "text", "primaryKey": false, "notNull": true }, "mode": { "name": "mode", "type": "varchar(20)", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.shared_conversations": { "name": "shared_conversations", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "share_id": { "name": "share_id", "type": "varchar(64)", "primaryKey": false, "notNull": true }, "conversation_id": { "name": "conversation_id", "type": "varchar(64)", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "varchar(64)", "primaryKey": false, "notNull": true }, "share_code": { "name": "share_code", "type": "varchar(12)", "primaryKey": false, "notNull": true }, "title": { "name": "title", "type": "varchar(255)", "primaryKey": false, "notNull": false }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "include_thinking": { "name": "include_thinking", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "include_tool_calls": { "name": "include_tool_calls", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "include_images": { "name": "include_images", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "view_count": { "name": "view_count", "type": "integer", "primaryKey": false, "notNull": false, "default": 0 }, "is_active": { "name": "is_active", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "snapshot_at": { "name": "snapshot_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "selected_message_ids": { "name": "selected_message_ids", "type": "jsonb", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "shared_conversations_share_id_unique": { "name": "shared_conversations_share_id_unique", "nullsNotDistinct": false, "columns": [ "share_id" ] }, "shared_conversations_share_code_unique": { "name": "shared_conversations_share_code_unique", "nullsNotDistinct": false, "columns": [ "share_code" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.tools": { "name": "tools", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "tool_id": { "name": "tool_id", "type": "varchar(64)", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "varchar(64)", "primaryKey": false, "notNull": true }, "display_name": { "name": "display_name", "type": "varchar(128)", "primaryKey": false, "notNull": true }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false }, "icon": { "name": "icon", "type": "varchar(64)", "primaryKey": false, "notNull": false }, "input_schema": { "name": "input_schema", "type": "jsonb", "primaryKey": false, "notNull": true }, "is_enabled": { "name": "is_enabled", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "is_default": { "name": "is_default", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "sort_order": { "name": "sort_order", "type": "integer", "primaryKey": false, "notNull": false, "default": 0 }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "tools_tool_id_unique": { "name": "tools_tool_id_unique", "nullsNotDistinct": false, "columns": [ "tool_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.user_favorite_assistants": { "name": "user_favorite_assistants", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "user_id": { "name": "user_id", "type": "varchar(64)", "primaryKey": false, "notNull": true }, "assistant_id": { "name": "assistant_id", "type": "integer", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.user_settings": { "name": "user_settings", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "user_id": { "name": "user_id", "type": "varchar(64)", "primaryKey": false, "notNull": false }, "cch_url": { "name": "cch_url", "type": "varchar(512)", "primaryKey": false, "notNull": true, "default": "'http://localhost:13500'" }, "cch_api_key": { "name": "cch_api_key", "type": "varchar(512)", "primaryKey": false, "notNull": false }, "cch_api_key_configured": { "name": "cch_api_key_configured", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "metaso_api_key": { "name": "metaso_api_key", "type": "varchar(512)", "primaryKey": false, "notNull": false }, "metaso_api_key_configured": { "name": "metaso_api_key_configured", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "api_format": { "name": "api_format", "type": "varchar(20)", "primaryKey": false, "notNull": false, "default": "'claude'" }, "default_model": { "name": "default_model", "type": "varchar(64)", "primaryKey": false, "notNull": false, "default": "'claude-sonnet-4-5-20250929'" }, "default_tools": { "name": "default_tools", "type": "jsonb", "primaryKey": false, "notNull": false, "default": "'[\"web_search\",\"web_fetch\",\"mita_search\",\"mita_reader\"]'::jsonb" }, "system_prompt": { "name": "system_prompt", "type": "text", "primaryKey": false, "notNull": false }, "temperature": { "name": "temperature", "type": "varchar(10)", "primaryKey": false, "notNull": false, "default": "'0.7'" }, "theme": { "name": "theme", "type": "varchar(20)", "primaryKey": false, "notNull": false, "default": "'light'" }, "language": { "name": "language", "type": "varchar(10)", "primaryKey": false, "notNull": false, "default": "'zh-CN'" }, "font_size": { "name": "font_size", "type": "integer", "primaryKey": false, "notNull": false, "default": 15 }, "enable_thinking": { "name": "enable_thinking", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "save_chat_history": { "name": "save_chat_history", "type": "boolean", "primaryKey": false, "notNull": false, "default": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "user_settings_user_id_unique": { "name": "user_settings_user_id_unique", "nullsNotDistinct": false, "columns": [ "user_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.users": { "name": "users", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "user_id": { "name": "user_id", "type": "varchar(64)", "primaryKey": false, "notNull": true }, "email": { "name": "email", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "password": { "name": "password", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "nickname": { "name": "nickname", "type": "varchar(64)", "primaryKey": false, "notNull": true }, "avatar": { "name": "avatar", "type": "varchar(512)", "primaryKey": false, "notNull": false }, "plan": { "name": "plan", "type": "varchar(20)", "primaryKey": false, "notNull": false, "default": "'free'" }, "status": { "name": "status", "type": "varchar(20)", "primaryKey": false, "notNull": false, "default": "'active'" }, "email_verified": { "name": "email_verified", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "last_login_at": { "name": "last_login_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "users_user_id_unique": { "name": "users_user_id_unique", "nullsNotDistinct": false, "columns": [ "user_id" ] }, "users_email_unique": { "name": "users_email_unique", "nullsNotDistinct": false, "columns": [ "email" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.verification_codes": { "name": "verification_codes", "schema": "", "columns": { "id": { "name": "id", "type": "serial", "primaryKey": true, "notNull": true }, "email": { "name": "email", "type": "varchar(255)", "primaryKey": false, "notNull": true }, "code": { "name": "code", "type": "varchar(6)", "primaryKey": false, "notNull": true }, "type": { "name": "type", "type": "varchar(20)", "primaryKey": false, "notNull": true }, "expires_at": { "name": "expires_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true }, "used": { "name": "used", "type": "boolean", "primaryKey": false, "notNull": false, "default": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false } }, "enums": {}, "schemas": {}, "sequences": {}, "roles": {}, "policies": {}, "views": {}, "_meta": { "columns": {}, "schemas": {}, "tables": {} } }