I have searched the existing issues and discussions.
I am using the latest version of Open WebUI.
Installation Method
pip install
Open WebUI Version
0.6.18
Ollama Version (if applicable)
0.9.6
Operating System
Windows 10
Browser (if applicable)
Chrome 138.0.7204.97
Confirmation
I have read and followed all instructions in README.md.
I am using the latest version of both Open WebUI and Ollama.
I have included the browser console logs.
I have included the Docker container logs.
I have provided every relevant configuration, setting, and environment variable used in my setup.
I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
Start with the initial platform/version/OS and dependencies used,
Specify exact install/launch/configure commands,
List URLs visited, user input (incl. example values/emails/passwords if needed),
Describe all options and toggles enabled or changed,
Include any files or environmental changes,
Identify the expected and actual result at each stage,
Ensure any reasonably skilled user can follow and hit the same issue.
Expected Behavior
UPDATE config SET updated_at = EXTRACT(EPOCH FROM NOW());
Actual Behavior
updated_at='2025-07-26T21:04:02.376784'::timestamp WHERE config.id = 1
Steps to Reproduce
1,只有更新 config 表的时候才会出现这个错误
2,其他表没有这个问题,其他表的 updated_at 也是 BIGINT 类型
3,在此之前,我曾用 sql 转换过大部分的 updated_at 字段为 BIGINT 类型
4,使用的转换代码如下:
`/*
PostgreSQL Data Transfer - Converted from SQLite
-- Enable UUID extension for generating UUIDs
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- Table structure for alembic_version
DROP TABLE IF EXISTS "alembic_version";
CREATE TABLE "alembic_version" (
"version_num" VARCHAR(32) NOT NULL,
CONSTRAINT "alembic_version_pkc" PRIMARY KEY ("version_num")
);
-- Records of alembic_version
INSERT INTO "alembic_version" VALUES ('d31026856c01');
-- Table structure for auth
DROP TABLE IF EXISTS "auth";
CREATE TABLE "auth" (
"id" VARCHAR(255) NOT NULL,
"email" VARCHAR(255) NOT NULL,
"password" TEXT NOT NULL,
"active" BOOLEAN NOT NULL DEFAULT FALSE
);
-- Table structure for channel
DROP TABLE IF EXISTS "channel";
CREATE TABLE "channel" (
"id" TEXT NOT NULL,
"user_id" TEXT,
"name" TEXT,
"description" TEXT,
"data" JSONB,
"meta" JSONB,
"access_control" JSONB,
"created_at" BIGINT,
"updated_at" BIGINT,
"type" TEXT,
PRIMARY KEY ("id")
);
-- Table structure for channel_member
DROP TABLE IF EXISTS "channel_member";
CREATE TABLE "channel_member" (
"id" TEXT NOT NULL,
"channel_id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"created_at" BIGINT,
PRIMARY KEY ("id")
);
-- Table structure for chat
DROP TABLE IF EXISTS "chat";
CREATE TABLE "chat" (
"id" VARCHAR(255) NOT NULL,
"user_id" VARCHAR(255) NOT NULL,
"title" TEXT NOT NULL,
"share_id" VARCHAR(255),
"archived" BOOLEAN NOT NULL DEFAULT FALSE,
"created_at" TIMESTAMP NOT NULL,
"updated_at" TIMESTAMP NOT NULL,
"chat" JSONB,
"pinned" BOOLEAN,
"meta" JSONB NOT NULL DEFAULT '{}',
"folder_id" TEXT
);
-- Table structure for chatidtag
DROP TABLE IF EXISTS "chatidtag";
CREATE TABLE "chatidtag" (
"id" VARCHAR(255) NOT NULL,
"tag_name" VARCHAR(255) NOT NULL,
"chat_id" VARCHAR(255) NOT NULL,
"user_id" VARCHAR(255) NOT NULL,
"timestamp" INTEGER NOT NULL
);
-- Table structure for config
DROP TABLE IF EXISTS "config";
CREATE TABLE "config" (
"id" SERIAL NOT NULL,
"data" JSONB NOT NULL,
"version" INTEGER NOT NULL,
"created_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY ("id")
);
-- Table structure for document
DROP TABLE IF EXISTS "document";
CREATE TABLE "document" (
"id" SERIAL NOT NULL,
"collection_name" VARCHAR(255) NOT NULL,
"name" VARCHAR(255) NOT NULL,
"title" TEXT NOT NULL,
"filename" TEXT NOT NULL,
"content" TEXT,
"user_id" VARCHAR(255) NOT NULL,
"timestamp" INTEGER NOT NULL,
PRIMARY KEY ("id")
);
-- Table structure for feedback
DROP TABLE IF EXISTS "feedback";
CREATE TABLE "feedback" (
"id" TEXT NOT NULL,
"user_id" TEXT,
"version" BIGINT,
"type" TEXT,
"data" JSONB,
"meta" JSONB,
"snapshot" JSONB,
"created_at" BIGINT NOT NULL,
"updated_at" BIGINT NOT NULL,
PRIMARY KEY ("id")
);
-- Table structure for file
DROP TABLE IF EXISTS "file";
CREATE TABLE "file" (
"id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"filename" TEXT NOT NULL,
"meta" JSONB,
"created_at" INTEGER NOT NULL,
"hash" TEXT,
"data" JSONB,
"updated_at" BIGINT,
"path" TEXT,
"access_control" JSONB
);
-- Table structure for folder
DROP TABLE IF EXISTS "folder";
CREATE TABLE "folder" (
"id" TEXT NOT NULL,
"parent_id" TEXT,
"user_id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"items" JSONB,
"meta" JSONB,
"is_expanded" BOOLEAN NOT NULL,
"created_at" BIGINT NOT NULL,
"updated_at" BIGINT NOT NULL,
"data" JSONB,
PRIMARY KEY ("id", "user_id")
);
-- Table structure for function
DROP TABLE IF EXISTS "function";
CREATE TABLE "function" (
"id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"type" TEXT NOT NULL,
"content" TEXT NOT NULL,
"meta" TEXT NOT NULL,
"created_at" INTEGER NOT NULL,
"updated_at" INTEGER NOT NULL,
"valves" TEXT,
"is_active" BOOLEAN NOT NULL DEFAULT FALSE,
"is_global" BOOLEAN NOT NULL DEFAULT FALSE
);
-- Table structure for group
DROP TABLE IF EXISTS "group";
CREATE TABLE "group" (
"id" TEXT NOT NULL,
"user_id" TEXT,
"name" TEXT,
"description" TEXT,
"data" JSONB,
"meta" JSONB,
"permissions" JSONB,
"user_ids" JSONB,
"created_at" BIGINT,
"updated_at" BIGINT,
PRIMARY KEY ("id")
);
-- Table structure for knowledge
DROP TABLE IF EXISTS "knowledge";
CREATE TABLE "knowledge" (
"id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"description" TEXT,
"data" JSONB,
"meta" JSONB,
"created_at" BIGINT NOT NULL,
"updated_at" BIGINT,
"access_control" JSONB,
PRIMARY KEY ("id")
);
-- Table structure for memory
DROP TABLE IF EXISTS "memory";
CREATE TABLE "memory" (
"id" VARCHAR(255) NOT NULL,
"user_id" VARCHAR(255) NOT NULL,
"content" TEXT NOT NULL,
"updated_at" INTEGER NOT NULL,
"created_at" INTEGER NOT NULL
);
-- Table structure for message
DROP TABLE IF EXISTS "message";
CREATE TABLE "message" (
"id" TEXT NOT NULL,
"user_id" TEXT,
"channel_id" TEXT,
"content" TEXT,
"data" JSONB,
"meta" JSONB,
"created_at" BIGINT,
"updated_at" BIGINT,
"parent_id" TEXT,
PRIMARY KEY ("id")
);
-- Table structure for message_reaction
DROP TABLE IF EXISTS "message_reaction";
CREATE TABLE "message_reaction" (
"id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"message_id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"created_at" BIGINT,
PRIMARY KEY ("id")
);
-- Table structure for migratehistory
DROP TABLE IF EXISTS "migratehistory";
CREATE TABLE "migratehistory" (
"id" SERIAL NOT NULL,
"name" VARCHAR(255) NOT NULL,
"migrated_at" TIMESTAMP NOT NULL,
PRIMARY KEY ("id")
);
DROP TABLE IF EXISTS "model";
CREATE TABLE "model" (
"id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"base_model_id" TEXT,
"name" TEXT NOT NULL,
"meta" TEXT NOT NULL,
"params" TEXT NOT NULL,
"created_at" INTEGER NOT NULL,
"updated_at" INTEGER NOT NULL,
"access_control" JSONB,
"is_active" BOOLEAN NOT NULL DEFAULT TRUE
);
-- Table structure for note
DROP TABLE IF EXISTS "note";
CREATE TABLE "note" (
"id" TEXT NOT NULL,
"user_id" TEXT,
"title" TEXT,
"data" JSONB,
"meta" JSONB,
"access_control" JSONB,
"created_at" BIGINT,
"updated_at" BIGINT,
PRIMARY KEY ("id")
);
-- Table structure for prompt
DROP TABLE IF EXISTS "prompt";
CREATE TABLE "prompt" (
"id" SERIAL NOT NULL,
"command" VARCHAR(255) NOT NULL,
"user_id" VARCHAR(255) NOT NULL,
"title" TEXT NOT NULL,
"content" TEXT NOT NULL,
"timestamp" INTEGER NOT NULL,
"access_control" JSONB,
PRIMARY KEY ("id")
);
-- Table structure for tag
DROP TABLE IF EXISTS "tag";
CREATE TABLE "tag" (
"id" VARCHAR(255) NOT NULL,
"name" VARCHAR(255) NOT NULL,
"user_id" VARCHAR(255) NOT NULL,
"meta" JSONB,
CONSTRAINT "pk_id_user_id" PRIMARY KEY ("id", "user_id")
);
-- Table structure for tool
DROP TABLE IF EXISTS "tool";
CREATE TABLE "tool" (
"id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"content" TEXT NOT NULL,
"specs" TEXT NOT NULL,
"meta" TEXT NOT NULL,
"created_at" INTEGER NOT NULL,
"updated_at" INTEGER NOT NULL,
"valves" TEXT,
"access_control" JSONB
);
-- Table structure for user
DROP TABLE IF EXISTS "user";
CREATE TABLE "user" (
"id" VARCHAR(255) NOT NULL,
"name" VARCHAR(255) NOT NULL,
"email" VARCHAR(255) NOT NULL,
"role" VARCHAR(255) NOT NULL,
"profile_image_url" TEXT NOT NULL,
"api_key" VARCHAR(255),
"created_at" INTEGER NOT NULL,
"updated_at" INTEGER NOT NULL,
"last_active_at" INTEGER NOT NULL,
"settings" TEXT,
"info" TEXT,
"oauth_sub" TEXT
);
-- Create Indexes
-- auth table indexes
CREATE UNIQUE INDEX "auth_id" ON "auth" ("id");
-- chat table indexes
CREATE UNIQUE INDEX "chat_id" ON "chat" ("id");
CREATE UNIQUE INDEX "chat_share_id" ON "chat" ("share_id");
-- chatidtag table indexes
CREATE UNIQUE INDEX "chatidtag_id" ON "chatidtag" ("id");
-- document table indexes
CREATE UNIQUE INDEX "document_collection_name" ON "document" ("collection_name");
CREATE UNIQUE INDEX "document_name" ON "document" ("name");
-- file table indexes
CREATE UNIQUE INDEX "file_id" ON "file" ("id");
-- function table indexes
CREATE UNIQUE INDEX "function_id" ON "function" ("id");
-- memory table indexes
CREATE UNIQUE INDEX "memory_id" ON "memory" ("id");
-- model table indexes
CREATE UNIQUE INDEX "model_id" ON "model" ("id");
-- prompt table indexes
CREATE UNIQUE INDEX "prompt_command" ON "prompt" ("command");
-- tool table indexes
CREATE UNIQUE INDEX "tool_id" ON "tool" ("id");
-- user table indexes
CREATE UNIQUE INDEX "user_api_key" ON "user" ("api_key");
CREATE UNIQUE INDEX "user_id" ON "user" ("id");
CREATE UNIQUE INDEX "user_oauth_sub" ON "user" ("oauth_sub");
-- Create Foreign Key Constraints (Optional - based on relationships)
-- Channel member references
ALTER TABLE "channel_member" ADD CONSTRAINT "fk_channel_member_channel"
FOREIGN KEY ("channel_id") REFERENCES "channel" ("id") ON DELETE CASCADE;
ALTER TABLE "channel_member" ADD CONSTRAINT "fk_channel_member_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Chat references
ALTER TABLE "chat" ADD CONSTRAINT "fk_chat_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Note: folder reference requires composite foreign key since folder has composite primary key
ALTER TABLE "chat" ADD CONSTRAINT "fk_chat_folder"
FOREIGN KEY ("folder_id", "user_id") REFERENCES "folder" ("id", "user_id") ON DELETE SET NULL;
-- Message references
ALTER TABLE "message" ADD CONSTRAINT "fk_message_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
ALTER TABLE "message" ADD CONSTRAINT "fk_message_channel"
FOREIGN KEY ("channel_id") REFERENCES "channel" ("id") ON DELETE CASCADE;
ALTER TABLE "message" ADD CONSTRAINT "fk_message_parent"
FOREIGN KEY ("parent_id") REFERENCES "message" ("id") ON DELETE CASCADE;
-- Message reaction references
ALTER TABLE "message_reaction" ADD CONSTRAINT "fk_message_reaction_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
ALTER TABLE "message_reaction" ADD CONSTRAINT "fk_message_reaction_message"
FOREIGN KEY ("message_id") REFERENCES "message" ("id") ON DELETE CASCADE;
-- File references
ALTER TABLE "file" ADD CONSTRAINT "fk_file_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Function references
ALTER TABLE "function" ADD CONSTRAINT "fk_function_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Tool references
ALTER TABLE "tool" ADD CONSTRAINT "fk_tool_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Model references
ALTER TABLE "model" ADD CONSTRAINT "fk_model_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Memory references
ALTER TABLE "memory" ADD CONSTRAINT "fk_memory_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Knowledge references
ALTER TABLE "knowledge" ADD CONSTRAINT "fk_knowledge_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Document references
ALTER TABLE "document" ADD CONSTRAINT "fk_document_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Prompt references
ALTER TABLE "prompt" ADD CONSTRAINT "fk_prompt_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Tag references
ALTER TABLE "tag" ADD CONSTRAINT "fk_tag_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Create indexes for foreign keys to improve performance
CREATE INDEX "idx_channel_member_channel_id" ON "channel_member" ("channel_id");
CREATE INDEX "idx_channel_member_user_id" ON "channel_member" ("user_id");
CREATE INDEX "idx_chat_user_id" ON "chat" ("user_id");
CREATE INDEX "idx_chat_folder_id_user_id" ON "chat" ("folder_id", "user_id");
CREATE INDEX "idx_message_user_id" ON "message" ("user_id");
CREATE INDEX "idx_message_channel_id" ON "message" ("channel_id");
CREATE INDEX "idx_message_parent_id" ON "message" ("parent_id");
CREATE INDEX "idx_message_reaction_user_id" ON "message_reaction" ("user_id");
CREATE INDEX "idx_message_reaction_message_id" ON "message_reaction" ("message_id");
CREATE INDEX "idx_file_user_id" ON "file" ("user_id");
CREATE INDEX "idx_function_user_id" ON "function" ("user_id");
CREATE INDEX "idx_tool_user_id" ON "tool" ("user_id");
CREATE INDEX "idx_model_user_id" ON "model" ("user_id");
CREATE INDEX "idx_memory_user_id" ON "memory" ("user_id");
CREATE INDEX "idx_knowledge_user_id" ON "knowledge" ("user_id");
CREATE INDEX "idx_document_user_id" ON "document" ("user_id");
CREATE INDEX "idx_prompt_user_id" ON "prompt" ("user_id");
CREATE INDEX "idx_tag_user_id" ON "tag" ("user_id");
CREATE INDEX "idx_folder_user_id" ON "folder" ("user_id");
CREATE INDEX "idx_folder_parent_id_user_id" ON "folder" ("parent_id", "user_id");CREATE OR REPLACE FUNCTION json_array_length(jsonb_data JSONB)
RETURNS INTEGER
LANGUAGE plpgsql
IMMUTABLE
AS function
BEGIN
IF jsonb_data IS NULL THEN
RETURN 0;
END IF;
IF jsonb_typeof(jsonb_data) != 'array' THEN
RETURN 0;
END IF;
RETURN jsonb_array_length(jsonb_data);
END; function;ALTER TABLE "chat"
ALTER COLUMN "created_at" TYPE BIGINT USING EXTRACT(EPOCH FROM "created_at")::BIGINT,
ALTER COLUMN "updated_at" TYPE BIGINT USING EXTRACT(EPOCH FROM "updated_at")::BIGINT;
-- 修复 config 表的时间戳字段
ALTER TABLE "config"
ALTER COLUMN "created_at" TYPE BIGINT USING EXTRACT(EPOCH FROM "created_at")::BIGINT,
ALTER COLUMN "updated_at" TYPE BIGINT USING EXTRACT(EPOCH FROM "updated_at")::BIGINT;
-- 修复 migratehistory 表的时间戳字段
ALTER TABLE "migratehistory"
ALTER COLUMN "migrated_at" TYPE BIGINT USING EXTRACT(EPOCH FROM "migrated_at")::BIGINT;`
Logs & Screenshots
字段 "updated_at" 的类型为 bigint, 但表达式的类型为 timestamp without time zone 第 2938 个字符处
2025-07-26 21:04:02 CST 提示: 你需要重写或转换表达式
2025-07-26 21:04:02 CST 语句: UPDATE config SET data='{"ui": {"watermark": "\u8c08\u8d77\u54e5AI", "enable_signup": true, "default_user_role": "pending", "enable_user_webhooks": true, "enable_message_rating": true, "enable_community_sharing": true, "pending_user_overlay_title": "\u4f60\u7684\u8d26\u53f7\u7b49\u5f85\u6fc0\u6d3b", "pending_user_overlay_content": "\u598224\u5c0f\u65f6\u8fd8\u6ca1\u6fc0\u6d3b\uff0c\u8bf7\u8054\u7cfb "}, "auth": {"admin": {"show": true}, "api_key": {"enable": true, "allowed_endpoints": "", "endpoint_restrictions": false}, "jwt_expiry": "-1"}, "ldap": {"enable": false}, "user": {"permissions": {"chat": {"stt": true, "tts": true, "call": false, "edit": true, "share": true, "delete": false, "export": true, "controls": true, "temporary": true, "file_upload": false, "system_prompt": true, "multiple_models": false, "temporary_enforced": false}, "sharing": {"public_tools": false, "public_models": false, "public_prompts": false, "public_knowledge": false}, "features": {"notes": true, "web_search": false, "code_interpreter": true, "image_generation": false, "direct_tool_servers": false}, "workspace": {"tools": false, "models": false, "prompts": false, "knowledge": false}}}, "notes": {"enable": true}, "webui": {"url": "https://xxx"}, "version": 0, "channels": {"enable": false}, "webhook_url": "https://axxx/webhook", "rag": {"template": "### Task:\nRespond to the user query using the provided context, incorporating inline citations in the format [id] only when the tag includes an explicit id attribute (e.g., <source id="1">).\n\n### Guidelines:\n- If you don''t know the answer, clearly state that.\n- If uncertain, ask the user for clarification.\n- Respond in the same language as the user''s query.\n- If the context is unreadable or of poor quality, inform the user and provide the best possible answer.\n- If the answer isn''t present in the context but you possess the knowledge, explain this to the user and provide the answer using your own understanding.\n- Only include inline citations using [id] (e.g., [1], [2]) when the tag includes an id attribute.\n- Do not cite if the tag does not contain an id attribute.\n- Do not use XML tags in your response.\n- Ensure citations are concise and directly related to the information provided.\n\n### Example of Citation:\nIf the user asks about a specific topic and the information is found in a source with a provided id attribute, the response should include the citation like in the following example:\n* "According to the study, the proposed method increases efficiency by 20% [1]."\n\n### Output:\nProvide a clear and direct response to the user''s query, including inline citations in the format [id] only when the tag with id attribute is present in the context.\n\n\n{{CONTEXT}}\n\n\n<user_query>\n{{QUERY}}\n</user_query>\n"}}'::JSON, updated_at='2025-07-26T21:04:02.376784'::timestamp WHERE config.id = 1
Additional Information
初次使用,如有未了解的地方还请见谅
Originally created by @Gailun90 on GitHub (Jul 26, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/16041
### Check Existing Issues
- [x] I have searched the existing issues and discussions.
- [x] I am using the latest version of Open WebUI.
### Installation Method
pip install
### Open WebUI Version
0.6.18
### Ollama Version (if applicable)
0.9.6
### Operating System
Windows 10
### Browser (if applicable)
Chrome 138.0.7204.97
### Confirmation
- [x] I have read and followed all instructions in `README.md`.
- [x] I am using the latest version of **both** Open WebUI and Ollama.
- [x] I have included the browser console logs.
- [x] I have included the Docker container logs.
- [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.**
- [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
- [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps:
- Start with the initial platform/version/OS and dependencies used,
- Specify exact install/launch/configure commands,
- List URLs visited, user input (incl. example values/emails/passwords if needed),
- Describe all options and toggles enabled or changed,
- Include any files or environmental changes,
- Identify the expected and actual result at each stage,
- Ensure any reasonably skilled user can follow and hit the same issue.
### Expected Behavior
UPDATE config SET updated_at = EXTRACT(EPOCH FROM NOW());
### Actual Behavior
updated_at='2025-07-26T21:04:02.376784'::timestamp WHERE config.id = 1
### Steps to Reproduce
1,只有更新 config 表的时候才会出现这个错误
2,其他表没有这个问题,其他表的 updated_at 也是 BIGINT 类型
3,在此之前,我曾用 sql 转换过大部分的 updated_at 字段为 BIGINT 类型
4,使用的转换代码如下:
`/*
PostgreSQL Data Transfer - Converted from SQLite
Source: webui_1 SQLite Database
Target: PostgreSQL Database
Date: 26/07/2025 14:54:45
*/
-- Enable UUID extension for generating UUIDs
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- ----------------------------
-- Table structure for alembic_version
-- ----------------------------
DROP TABLE IF EXISTS "alembic_version";
CREATE TABLE "alembic_version" (
"version_num" VARCHAR(32) NOT NULL,
CONSTRAINT "alembic_version_pkc" PRIMARY KEY ("version_num")
);
-- ----------------------------
-- Records of alembic_version
-- ----------------------------
INSERT INTO "alembic_version" VALUES ('d31026856c01');
-- ----------------------------
-- Table structure for auth
-- ----------------------------
DROP TABLE IF EXISTS "auth";
CREATE TABLE "auth" (
"id" VARCHAR(255) NOT NULL,
"email" VARCHAR(255) NOT NULL,
"password" TEXT NOT NULL,
"active" BOOLEAN NOT NULL DEFAULT FALSE
);
-- ----------------------------
-- Table structure for channel
-- ----------------------------
DROP TABLE IF EXISTS "channel";
CREATE TABLE "channel" (
"id" TEXT NOT NULL,
"user_id" TEXT,
"name" TEXT,
"description" TEXT,
"data" JSONB,
"meta" JSONB,
"access_control" JSONB,
"created_at" BIGINT,
"updated_at" BIGINT,
"type" TEXT,
PRIMARY KEY ("id")
);
-- ----------------------------
-- Table structure for channel_member
-- ----------------------------
DROP TABLE IF EXISTS "channel_member";
CREATE TABLE "channel_member" (
"id" TEXT NOT NULL,
"channel_id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"created_at" BIGINT,
PRIMARY KEY ("id")
);
-- ----------------------------
-- Table structure for chat
-- ----------------------------
DROP TABLE IF EXISTS "chat";
CREATE TABLE "chat" (
"id" VARCHAR(255) NOT NULL,
"user_id" VARCHAR(255) NOT NULL,
"title" TEXT NOT NULL,
"share_id" VARCHAR(255),
"archived" BOOLEAN NOT NULL DEFAULT FALSE,
"created_at" TIMESTAMP NOT NULL,
"updated_at" TIMESTAMP NOT NULL,
"chat" JSONB,
"pinned" BOOLEAN,
"meta" JSONB NOT NULL DEFAULT '{}',
"folder_id" TEXT
);
-- ----------------------------
-- Table structure for chatidtag
-- ----------------------------
DROP TABLE IF EXISTS "chatidtag";
CREATE TABLE "chatidtag" (
"id" VARCHAR(255) NOT NULL,
"tag_name" VARCHAR(255) NOT NULL,
"chat_id" VARCHAR(255) NOT NULL,
"user_id" VARCHAR(255) NOT NULL,
"timestamp" INTEGER NOT NULL
);
-- ----------------------------
-- Table structure for config
-- ----------------------------
DROP TABLE IF EXISTS "config";
CREATE TABLE "config" (
"id" SERIAL NOT NULL,
"data" JSONB NOT NULL,
"version" INTEGER NOT NULL,
"created_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY ("id")
);
-- ----------------------------
-- Table structure for document
-- ----------------------------
DROP TABLE IF EXISTS "document";
CREATE TABLE "document" (
"id" SERIAL NOT NULL,
"collection_name" VARCHAR(255) NOT NULL,
"name" VARCHAR(255) NOT NULL,
"title" TEXT NOT NULL,
"filename" TEXT NOT NULL,
"content" TEXT,
"user_id" VARCHAR(255) NOT NULL,
"timestamp" INTEGER NOT NULL,
PRIMARY KEY ("id")
);
-- ----------------------------
-- Table structure for feedback
-- ----------------------------
DROP TABLE IF EXISTS "feedback";
CREATE TABLE "feedback" (
"id" TEXT NOT NULL,
"user_id" TEXT,
"version" BIGINT,
"type" TEXT,
"data" JSONB,
"meta" JSONB,
"snapshot" JSONB,
"created_at" BIGINT NOT NULL,
"updated_at" BIGINT NOT NULL,
PRIMARY KEY ("id")
);
-- ----------------------------
-- Table structure for file
-- ----------------------------
DROP TABLE IF EXISTS "file";
CREATE TABLE "file" (
"id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"filename" TEXT NOT NULL,
"meta" JSONB,
"created_at" INTEGER NOT NULL,
"hash" TEXT,
"data" JSONB,
"updated_at" BIGINT,
"path" TEXT,
"access_control" JSONB
);
-- ----------------------------
-- Table structure for folder
-- ----------------------------
DROP TABLE IF EXISTS "folder";
CREATE TABLE "folder" (
"id" TEXT NOT NULL,
"parent_id" TEXT,
"user_id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"items" JSONB,
"meta" JSONB,
"is_expanded" BOOLEAN NOT NULL,
"created_at" BIGINT NOT NULL,
"updated_at" BIGINT NOT NULL,
"data" JSONB,
PRIMARY KEY ("id", "user_id")
);
-- ----------------------------
-- Table structure for function
-- ----------------------------
DROP TABLE IF EXISTS "function";
CREATE TABLE "function" (
"id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"type" TEXT NOT NULL,
"content" TEXT NOT NULL,
"meta" TEXT NOT NULL,
"created_at" INTEGER NOT NULL,
"updated_at" INTEGER NOT NULL,
"valves" TEXT,
"is_active" BOOLEAN NOT NULL DEFAULT FALSE,
"is_global" BOOLEAN NOT NULL DEFAULT FALSE
);
-- ----------------------------
-- Table structure for group
-- ----------------------------
DROP TABLE IF EXISTS "group";
CREATE TABLE "group" (
"id" TEXT NOT NULL,
"user_id" TEXT,
"name" TEXT,
"description" TEXT,
"data" JSONB,
"meta" JSONB,
"permissions" JSONB,
"user_ids" JSONB,
"created_at" BIGINT,
"updated_at" BIGINT,
PRIMARY KEY ("id")
);
-- ----------------------------
-- Table structure for knowledge
-- ----------------------------
DROP TABLE IF EXISTS "knowledge";
CREATE TABLE "knowledge" (
"id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"description" TEXT,
"data" JSONB,
"meta" JSONB,
"created_at" BIGINT NOT NULL,
"updated_at" BIGINT,
"access_control" JSONB,
PRIMARY KEY ("id")
);
-- ----------------------------
-- Table structure for memory
-- ----------------------------
DROP TABLE IF EXISTS "memory";
CREATE TABLE "memory" (
"id" VARCHAR(255) NOT NULL,
"user_id" VARCHAR(255) NOT NULL,
"content" TEXT NOT NULL,
"updated_at" INTEGER NOT NULL,
"created_at" INTEGER NOT NULL
);
-- ----------------------------
-- Table structure for message
-- ----------------------------
DROP TABLE IF EXISTS "message";
CREATE TABLE "message" (
"id" TEXT NOT NULL,
"user_id" TEXT,
"channel_id" TEXT,
"content" TEXT,
"data" JSONB,
"meta" JSONB,
"created_at" BIGINT,
"updated_at" BIGINT,
"parent_id" TEXT,
PRIMARY KEY ("id")
);
-- ----------------------------
-- Table structure for message_reaction
-- ----------------------------
DROP TABLE IF EXISTS "message_reaction";
CREATE TABLE "message_reaction" (
"id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"message_id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"created_at" BIGINT,
PRIMARY KEY ("id")
);
-- ----------------------------
-- Table structure for migratehistory
-- ----------------------------
DROP TABLE IF EXISTS "migratehistory";
CREATE TABLE "migratehistory" (
"id" SERIAL NOT NULL,
"name" VARCHAR(255) NOT NULL,
"migrated_at" TIMESTAMP NOT NULL,
PRIMARY KEY ("id")
);
-- ----------------------------
-- Records of migratehistory
-- ----------------------------
INSERT INTO "migratehistory" ("name", "migrated_at") VALUES
('001_initial_schema', '2025-07-26 06:47:10.224018'),
('002_add_local_sharing', '2025-07-26 06:47:10.232187'),
('003_add_auth_api_key', '2025-07-26 06:47:10.239533'),
('004_add_archived', '2025-07-26 06:47:10.248870'),
('005_add_updated_at', '2025-07-26 06:47:10.261509'),
('006_migrate_timestamps_and_charfields', '2025-07-26 06:47:10.281351'),
('007_add_user_last_active_at', '2025-07-26 06:47:10.295582'),
('008_add_memory', '2025-07-26 06:47:10.304301'),
('009_add_models', '2025-07-26 06:47:10.311846'),
('010_migrate_modelfiles_to_models', '2025-07-26 06:47:10.321312'),
('011_add_user_settings', '2025-07-26 06:47:10.328392'),
('012_add_tools', '2025-07-26 06:47:10.337807'),
('013_add_user_info', '2025-07-26 06:47:10.343464'),
('014_add_files', '2025-07-26 06:47:10.348693'),
('015_add_functions', '2025-07-26 06:47:10.355710'),
('016_add_valves_and_is_active', '2025-07-26 06:47:10.366059'),
('017_add_user_oauth_sub', '2025-07-26 06:47:10.372867'),
('018_add_function_is_global', '2025-07-26 06:47:10.382070');
-- ----------------------------
-- Table structure for model
-- ----------------------------
DROP TABLE IF EXISTS "model";
CREATE TABLE "model" (
"id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"base_model_id" TEXT,
"name" TEXT NOT NULL,
"meta" TEXT NOT NULL,
"params" TEXT NOT NULL,
"created_at" INTEGER NOT NULL,
"updated_at" INTEGER NOT NULL,
"access_control" JSONB,
"is_active" BOOLEAN NOT NULL DEFAULT TRUE
);
-- ----------------------------
-- Table structure for note
-- ----------------------------
DROP TABLE IF EXISTS "note";
CREATE TABLE "note" (
"id" TEXT NOT NULL,
"user_id" TEXT,
"title" TEXT,
"data" JSONB,
"meta" JSONB,
"access_control" JSONB,
"created_at" BIGINT,
"updated_at" BIGINT,
PRIMARY KEY ("id")
);
-- ----------------------------
-- Table structure for prompt
-- ----------------------------
DROP TABLE IF EXISTS "prompt";
CREATE TABLE "prompt" (
"id" SERIAL NOT NULL,
"command" VARCHAR(255) NOT NULL,
"user_id" VARCHAR(255) NOT NULL,
"title" TEXT NOT NULL,
"content" TEXT NOT NULL,
"timestamp" INTEGER NOT NULL,
"access_control" JSONB,
PRIMARY KEY ("id")
);
-- ----------------------------
-- Table structure for tag
-- ----------------------------
DROP TABLE IF EXISTS "tag";
CREATE TABLE "tag" (
"id" VARCHAR(255) NOT NULL,
"name" VARCHAR(255) NOT NULL,
"user_id" VARCHAR(255) NOT NULL,
"meta" JSONB,
CONSTRAINT "pk_id_user_id" PRIMARY KEY ("id", "user_id")
);
-- ----------------------------
-- Table structure for tool
-- ----------------------------
DROP TABLE IF EXISTS "tool";
CREATE TABLE "tool" (
"id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"content" TEXT NOT NULL,
"specs" TEXT NOT NULL,
"meta" TEXT NOT NULL,
"created_at" INTEGER NOT NULL,
"updated_at" INTEGER NOT NULL,
"valves" TEXT,
"access_control" JSONB
);
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS "user";
CREATE TABLE "user" (
"id" VARCHAR(255) NOT NULL,
"name" VARCHAR(255) NOT NULL,
"email" VARCHAR(255) NOT NULL,
"role" VARCHAR(255) NOT NULL,
"profile_image_url" TEXT NOT NULL,
"api_key" VARCHAR(255),
"created_at" INTEGER NOT NULL,
"updated_at" INTEGER NOT NULL,
"last_active_at" INTEGER NOT NULL,
"settings" TEXT,
"info" TEXT,
"oauth_sub" TEXT
);
-- ----------------------------
-- Create Indexes
-- ----------------------------
-- auth table indexes
CREATE UNIQUE INDEX "auth_id" ON "auth" ("id");
-- chat table indexes
CREATE UNIQUE INDEX "chat_id" ON "chat" ("id");
CREATE UNIQUE INDEX "chat_share_id" ON "chat" ("share_id");
-- chatidtag table indexes
CREATE UNIQUE INDEX "chatidtag_id" ON "chatidtag" ("id");
-- document table indexes
CREATE UNIQUE INDEX "document_collection_name" ON "document" ("collection_name");
CREATE UNIQUE INDEX "document_name" ON "document" ("name");
-- file table indexes
CREATE UNIQUE INDEX "file_id" ON "file" ("id");
-- function table indexes
CREATE UNIQUE INDEX "function_id" ON "function" ("id");
-- memory table indexes
CREATE UNIQUE INDEX "memory_id" ON "memory" ("id");
-- model table indexes
CREATE UNIQUE INDEX "model_id" ON "model" ("id");
-- prompt table indexes
CREATE UNIQUE INDEX "prompt_command" ON "prompt" ("command");
-- tool table indexes
CREATE UNIQUE INDEX "tool_id" ON "tool" ("id");
-- user table indexes
CREATE UNIQUE INDEX "user_api_key" ON "user" ("api_key");
CREATE UNIQUE INDEX "user_id" ON "user" ("id");
CREATE UNIQUE INDEX "user_oauth_sub" ON "user" ("oauth_sub");
-- ----------------------------
-- Create Foreign Key Constraints (Optional - based on relationships)
-- ----------------------------
-- Channel member references
ALTER TABLE "channel_member" ADD CONSTRAINT "fk_channel_member_channel"
FOREIGN KEY ("channel_id") REFERENCES "channel" ("id") ON DELETE CASCADE;
ALTER TABLE "channel_member" ADD CONSTRAINT "fk_channel_member_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Chat references
ALTER TABLE "chat" ADD CONSTRAINT "fk_chat_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Note: folder reference requires composite foreign key since folder has composite primary key
ALTER TABLE "chat" ADD CONSTRAINT "fk_chat_folder"
FOREIGN KEY ("folder_id", "user_id") REFERENCES "folder" ("id", "user_id") ON DELETE SET NULL;
-- Message references
ALTER TABLE "message" ADD CONSTRAINT "fk_message_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
ALTER TABLE "message" ADD CONSTRAINT "fk_message_channel"
FOREIGN KEY ("channel_id") REFERENCES "channel" ("id") ON DELETE CASCADE;
ALTER TABLE "message" ADD CONSTRAINT "fk_message_parent"
FOREIGN KEY ("parent_id") REFERENCES "message" ("id") ON DELETE CASCADE;
-- Message reaction references
ALTER TABLE "message_reaction" ADD CONSTRAINT "fk_message_reaction_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
ALTER TABLE "message_reaction" ADD CONSTRAINT "fk_message_reaction_message"
FOREIGN KEY ("message_id") REFERENCES "message" ("id") ON DELETE CASCADE;
-- File references
ALTER TABLE "file" ADD CONSTRAINT "fk_file_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Function references
ALTER TABLE "function" ADD CONSTRAINT "fk_function_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Tool references
ALTER TABLE "tool" ADD CONSTRAINT "fk_tool_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Model references
ALTER TABLE "model" ADD CONSTRAINT "fk_model_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Memory references
ALTER TABLE "memory" ADD CONSTRAINT "fk_memory_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Knowledge references
ALTER TABLE "knowledge" ADD CONSTRAINT "fk_knowledge_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Document references
ALTER TABLE "document" ADD CONSTRAINT "fk_document_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Prompt references
ALTER TABLE "prompt" ADD CONSTRAINT "fk_prompt_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Tag references
ALTER TABLE "tag" ADD CONSTRAINT "fk_tag_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Folder references
ALTER TABLE "folder" ADD CONSTRAINT "fk_folder_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Note: parent folder reference requires composite foreign key
ALTER TABLE "folder" ADD CONSTRAINT "fk_folder_parent"
FOREIGN KEY ("parent_id", "user_id") REFERENCES "folder" ("id", "user_id") ON DELETE CASCADE;
-- Create indexes for foreign keys to improve performance
CREATE INDEX "idx_channel_member_channel_id" ON "channel_member" ("channel_id");
CREATE INDEX "idx_channel_member_user_id" ON "channel_member" ("user_id");
CREATE INDEX "idx_chat_user_id" ON "chat" ("user_id");
CREATE INDEX "idx_chat_folder_id_user_id" ON "chat" ("folder_id", "user_id");
CREATE INDEX "idx_message_user_id" ON "message" ("user_id");
CREATE INDEX "idx_message_channel_id" ON "message" ("channel_id");
CREATE INDEX "idx_message_parent_id" ON "message" ("parent_id");
CREATE INDEX "idx_message_reaction_user_id" ON "message_reaction" ("user_id");
CREATE INDEX "idx_message_reaction_message_id" ON "message_reaction" ("message_id");
CREATE INDEX "idx_file_user_id" ON "file" ("user_id");
CREATE INDEX "idx_function_user_id" ON "function" ("user_id");
CREATE INDEX "idx_tool_user_id" ON "tool" ("user_id");
CREATE INDEX "idx_model_user_id" ON "model" ("user_id");
CREATE INDEX "idx_memory_user_id" ON "memory" ("user_id");
CREATE INDEX "idx_knowledge_user_id" ON "knowledge" ("user_id");
CREATE INDEX "idx_document_user_id" ON "document" ("user_id");
CREATE INDEX "idx_prompt_user_id" ON "prompt" ("user_id");
CREATE INDEX "idx_tag_user_id" ON "tag" ("user_id");
CREATE INDEX "idx_folder_user_id" ON "folder" ("user_id");
CREATE INDEX "idx_folder_parent_id_user_id" ON "folder" ("parent_id", "user_id");`
`CREATE OR REPLACE FUNCTION json_array_length(jsonb_data JSONB)
RETURNS INTEGER
LANGUAGE plpgsql
IMMUTABLE
AS $function$
BEGIN
IF jsonb_data IS NULL THEN
RETURN 0;
END IF;
IF jsonb_typeof(jsonb_data) != 'array' THEN
RETURN 0;
END IF;
RETURN jsonb_array_length(jsonb_data);
END;
$function$;`
`ALTER TABLE "chat"
ALTER COLUMN "created_at" TYPE BIGINT USING EXTRACT(EPOCH FROM "created_at")::BIGINT,
ALTER COLUMN "updated_at" TYPE BIGINT USING EXTRACT(EPOCH FROM "updated_at")::BIGINT;
-- 修复 config 表的时间戳字段
ALTER TABLE "config"
ALTER COLUMN "created_at" TYPE BIGINT USING EXTRACT(EPOCH FROM "created_at")::BIGINT,
ALTER COLUMN "updated_at" TYPE BIGINT USING EXTRACT(EPOCH FROM "updated_at")::BIGINT;
-- 修复 migratehistory 表的时间戳字段
ALTER TABLE "migratehistory"
ALTER COLUMN "migrated_at" TYPE BIGINT USING EXTRACT(EPOCH FROM "migrated_at")::BIGINT;`
### Logs & Screenshots
字段 "updated_at" 的类型为 bigint, 但表达式的类型为 timestamp without time zone 第 2938 个字符处
2025-07-26 21:04:02 CST 提示: 你需要重写或转换表达式
2025-07-26 21:04:02 CST 语句: UPDATE config SET data='{"ui": {"watermark": "\u8c08\u8d77\u54e5AI", "enable_signup": true, "default_user_role": "pending", "enable_user_webhooks": true, "enable_message_rating": true, "enable_community_sharing": true, "pending_user_overlay_title": "\u4f60\u7684\u8d26\u53f7\u7b49\u5f85\u6fc0\u6d3b", "pending_user_overlay_content": "\u598224\u5c0f\u65f6\u8fd8\u6ca1\u6fc0\u6d3b\uff0c\u8bf7\u8054\u7cfb "}, "auth": {"admin": {"show": true}, "api_key": {"enable": true, "allowed_endpoints": "", "endpoint_restrictions": false}, "jwt_expiry": "-1"}, "ldap": {"enable": false}, "user": {"permissions": {"chat": {"stt": true, "tts": true, "call": false, "edit": true, "share": true, "delete": false, "export": true, "controls": true, "temporary": true, "file_upload": false, "system_prompt": true, "multiple_models": false, "temporary_enforced": false}, "sharing": {"public_tools": false, "public_models": false, "public_prompts": false, "public_knowledge": false}, "features": {"notes": true, "web_search": false, "code_interpreter": true, "image_generation": false, "direct_tool_servers": false}, "workspace": {"tools": false, "models": false, "prompts": false, "knowledge": false}}}, "notes": {"enable": true}, "webui": {"url": "https://xxx"}, "version": 0, "channels": {"enable": false}, "webhook_url": "https://axxx/webhook", "rag": {"template": "### Task:\nRespond to the user query using the provided context, incorporating inline citations in the format [id] **only when the <source> tag includes an explicit id attribute** (e.g., <source id=\"1\">).\n\n### Guidelines:\n- If you don''t know the answer, clearly state that.\n- If uncertain, ask the user for clarification.\n- Respond in the same language as the user''s query.\n- If the context is unreadable or of poor quality, inform the user and provide the best possible answer.\n- If the answer isn''t present in the context but you possess the knowledge, explain this to the user and provide the answer using your own understanding.\n- **Only include inline citations using [id] (e.g., [1], [2]) when the <source> tag includes an id attribute.**\n- Do not cite if the <source> tag does not contain an id attribute.\n- Do not use XML tags in your response.\n- Ensure citations are concise and directly related to the information provided.\n\n### Example of Citation:\nIf the user asks about a specific topic and the information is found in a source with a provided id attribute, the response should include the citation like in the following example:\n* \"According to the study, the proposed method increases efficiency by 20% [1].\"\n\n### Output:\nProvide a clear and direct response to the user''s query, including inline citations in the format [id] only when the <source> tag with id attribute is present in the context.\n\n<context>\n{{CONTEXT}}\n</context>\n\n<user_query>\n{{QUERY}}\n</user_query>\n"}}'::JSON, updated_at='2025-07-26T21:04:02.376784'::timestamp WHERE config.id = 1
### Additional Information
初次使用,如有未了解的地方还请见谅
GiteaMirror
added the bug label 2026-05-13 04:23:44 -05:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @Gailun90 on GitHub (Jul 26, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/16041
Check Existing Issues
Installation Method
pip install
Open WebUI Version
0.6.18
Ollama Version (if applicable)
0.9.6
Operating System
Windows 10
Browser (if applicable)
Chrome 138.0.7204.97
Confirmation
README.md.Expected Behavior
UPDATE config SET updated_at = EXTRACT(EPOCH FROM NOW());
Actual Behavior
updated_at='2025-07-26T21:04:02.376784'::timestamp WHERE config.id = 1
Steps to Reproduce
1,只有更新 config 表的时候才会出现这个错误
2,其他表没有这个问题,其他表的 updated_at 也是 BIGINT 类型
3,在此之前,我曾用 sql 转换过大部分的 updated_at 字段为 BIGINT 类型
4,使用的转换代码如下:
`/*
PostgreSQL Data Transfer - Converted from SQLite
Source: webui_1 SQLite Database
Target: PostgreSQL Database
Date: 26/07/2025 14:54:45
*/
-- Enable UUID extension for generating UUIDs
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- Table structure for alembic_version
DROP TABLE IF EXISTS "alembic_version";
CREATE TABLE "alembic_version" (
"version_num" VARCHAR(32) NOT NULL,
CONSTRAINT "alembic_version_pkc" PRIMARY KEY ("version_num")
);
-- Records of alembic_version
INSERT INTO "alembic_version" VALUES ('d31026856c01');
-- Table structure for auth
DROP TABLE IF EXISTS "auth";
CREATE TABLE "auth" (
"id" VARCHAR(255) NOT NULL,
"email" VARCHAR(255) NOT NULL,
"password" TEXT NOT NULL,
"active" BOOLEAN NOT NULL DEFAULT FALSE
);
-- Table structure for channel
DROP TABLE IF EXISTS "channel";
CREATE TABLE "channel" (
"id" TEXT NOT NULL,
"user_id" TEXT,
"name" TEXT,
"description" TEXT,
"data" JSONB,
"meta" JSONB,
"access_control" JSONB,
"created_at" BIGINT,
"updated_at" BIGINT,
"type" TEXT,
PRIMARY KEY ("id")
);
-- Table structure for channel_member
DROP TABLE IF EXISTS "channel_member";
CREATE TABLE "channel_member" (
"id" TEXT NOT NULL,
"channel_id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"created_at" BIGINT,
PRIMARY KEY ("id")
);
-- Table structure for chat
DROP TABLE IF EXISTS "chat";
CREATE TABLE "chat" (
"id" VARCHAR(255) NOT NULL,
"user_id" VARCHAR(255) NOT NULL,
"title" TEXT NOT NULL,
"share_id" VARCHAR(255),
"archived" BOOLEAN NOT NULL DEFAULT FALSE,
"created_at" TIMESTAMP NOT NULL,
"updated_at" TIMESTAMP NOT NULL,
"chat" JSONB,
"pinned" BOOLEAN,
"meta" JSONB NOT NULL DEFAULT '{}',
"folder_id" TEXT
);
-- Table structure for chatidtag
DROP TABLE IF EXISTS "chatidtag";
CREATE TABLE "chatidtag" (
"id" VARCHAR(255) NOT NULL,
"tag_name" VARCHAR(255) NOT NULL,
"chat_id" VARCHAR(255) NOT NULL,
"user_id" VARCHAR(255) NOT NULL,
"timestamp" INTEGER NOT NULL
);
-- Table structure for config
DROP TABLE IF EXISTS "config";
CREATE TABLE "config" (
"id" SERIAL NOT NULL,
"data" JSONB NOT NULL,
"version" INTEGER NOT NULL,
"created_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY ("id")
);
-- Table structure for document
DROP TABLE IF EXISTS "document";
CREATE TABLE "document" (
"id" SERIAL NOT NULL,
"collection_name" VARCHAR(255) NOT NULL,
"name" VARCHAR(255) NOT NULL,
"title" TEXT NOT NULL,
"filename" TEXT NOT NULL,
"content" TEXT,
"user_id" VARCHAR(255) NOT NULL,
"timestamp" INTEGER NOT NULL,
PRIMARY KEY ("id")
);
-- Table structure for feedback
DROP TABLE IF EXISTS "feedback";
CREATE TABLE "feedback" (
"id" TEXT NOT NULL,
"user_id" TEXT,
"version" BIGINT,
"type" TEXT,
"data" JSONB,
"meta" JSONB,
"snapshot" JSONB,
"created_at" BIGINT NOT NULL,
"updated_at" BIGINT NOT NULL,
PRIMARY KEY ("id")
);
-- Table structure for file
DROP TABLE IF EXISTS "file";
CREATE TABLE "file" (
"id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"filename" TEXT NOT NULL,
"meta" JSONB,
"created_at" INTEGER NOT NULL,
"hash" TEXT,
"data" JSONB,
"updated_at" BIGINT,
"path" TEXT,
"access_control" JSONB
);
-- Table structure for folder
DROP TABLE IF EXISTS "folder";
CREATE TABLE "folder" (
"id" TEXT NOT NULL,
"parent_id" TEXT,
"user_id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"items" JSONB,
"meta" JSONB,
"is_expanded" BOOLEAN NOT NULL,
"created_at" BIGINT NOT NULL,
"updated_at" BIGINT NOT NULL,
"data" JSONB,
PRIMARY KEY ("id", "user_id")
);
-- Table structure for function
DROP TABLE IF EXISTS "function";
CREATE TABLE "function" (
"id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"type" TEXT NOT NULL,
"content" TEXT NOT NULL,
"meta" TEXT NOT NULL,
"created_at" INTEGER NOT NULL,
"updated_at" INTEGER NOT NULL,
"valves" TEXT,
"is_active" BOOLEAN NOT NULL DEFAULT FALSE,
"is_global" BOOLEAN NOT NULL DEFAULT FALSE
);
-- Table structure for group
DROP TABLE IF EXISTS "group";
CREATE TABLE "group" (
"id" TEXT NOT NULL,
"user_id" TEXT,
"name" TEXT,
"description" TEXT,
"data" JSONB,
"meta" JSONB,
"permissions" JSONB,
"user_ids" JSONB,
"created_at" BIGINT,
"updated_at" BIGINT,
PRIMARY KEY ("id")
);
-- Table structure for knowledge
DROP TABLE IF EXISTS "knowledge";
CREATE TABLE "knowledge" (
"id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"description" TEXT,
"data" JSONB,
"meta" JSONB,
"created_at" BIGINT NOT NULL,
"updated_at" BIGINT,
"access_control" JSONB,
PRIMARY KEY ("id")
);
-- Table structure for memory
DROP TABLE IF EXISTS "memory";
CREATE TABLE "memory" (
"id" VARCHAR(255) NOT NULL,
"user_id" VARCHAR(255) NOT NULL,
"content" TEXT NOT NULL,
"updated_at" INTEGER NOT NULL,
"created_at" INTEGER NOT NULL
);
-- Table structure for message
DROP TABLE IF EXISTS "message";
CREATE TABLE "message" (
"id" TEXT NOT NULL,
"user_id" TEXT,
"channel_id" TEXT,
"content" TEXT,
"data" JSONB,
"meta" JSONB,
"created_at" BIGINT,
"updated_at" BIGINT,
"parent_id" TEXT,
PRIMARY KEY ("id")
);
-- Table structure for message_reaction
DROP TABLE IF EXISTS "message_reaction";
CREATE TABLE "message_reaction" (
"id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"message_id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"created_at" BIGINT,
PRIMARY KEY ("id")
);
-- Table structure for migratehistory
DROP TABLE IF EXISTS "migratehistory";
CREATE TABLE "migratehistory" (
"id" SERIAL NOT NULL,
"name" VARCHAR(255) NOT NULL,
"migrated_at" TIMESTAMP NOT NULL,
PRIMARY KEY ("id")
);
-- Records of migratehistory
INSERT INTO "migratehistory" ("name", "migrated_at") VALUES
('001_initial_schema', '2025-07-26 06:47:10.224018'),
('002_add_local_sharing', '2025-07-26 06:47:10.232187'),
('003_add_auth_api_key', '2025-07-26 06:47:10.239533'),
('004_add_archived', '2025-07-26 06:47:10.248870'),
('005_add_updated_at', '2025-07-26 06:47:10.261509'),
('006_migrate_timestamps_and_charfields', '2025-07-26 06:47:10.281351'),
('007_add_user_last_active_at', '2025-07-26 06:47:10.295582'),
('008_add_memory', '2025-07-26 06:47:10.304301'),
('009_add_models', '2025-07-26 06:47:10.311846'),
('010_migrate_modelfiles_to_models', '2025-07-26 06:47:10.321312'),
('011_add_user_settings', '2025-07-26 06:47:10.328392'),
('012_add_tools', '2025-07-26 06:47:10.337807'),
('013_add_user_info', '2025-07-26 06:47:10.343464'),
('014_add_files', '2025-07-26 06:47:10.348693'),
('015_add_functions', '2025-07-26 06:47:10.355710'),
('016_add_valves_and_is_active', '2025-07-26 06:47:10.366059'),
('017_add_user_oauth_sub', '2025-07-26 06:47:10.372867'),
('018_add_function_is_global', '2025-07-26 06:47:10.382070');
-- Table structure for model
DROP TABLE IF EXISTS "model";
CREATE TABLE "model" (
"id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"base_model_id" TEXT,
"name" TEXT NOT NULL,
"meta" TEXT NOT NULL,
"params" TEXT NOT NULL,
"created_at" INTEGER NOT NULL,
"updated_at" INTEGER NOT NULL,
"access_control" JSONB,
"is_active" BOOLEAN NOT NULL DEFAULT TRUE
);
-- Table structure for note
DROP TABLE IF EXISTS "note";
CREATE TABLE "note" (
"id" TEXT NOT NULL,
"user_id" TEXT,
"title" TEXT,
"data" JSONB,
"meta" JSONB,
"access_control" JSONB,
"created_at" BIGINT,
"updated_at" BIGINT,
PRIMARY KEY ("id")
);
-- Table structure for prompt
DROP TABLE IF EXISTS "prompt";
CREATE TABLE "prompt" (
"id" SERIAL NOT NULL,
"command" VARCHAR(255) NOT NULL,
"user_id" VARCHAR(255) NOT NULL,
"title" TEXT NOT NULL,
"content" TEXT NOT NULL,
"timestamp" INTEGER NOT NULL,
"access_control" JSONB,
PRIMARY KEY ("id")
);
-- Table structure for tag
DROP TABLE IF EXISTS "tag";
CREATE TABLE "tag" (
"id" VARCHAR(255) NOT NULL,
"name" VARCHAR(255) NOT NULL,
"user_id" VARCHAR(255) NOT NULL,
"meta" JSONB,
CONSTRAINT "pk_id_user_id" PRIMARY KEY ("id", "user_id")
);
-- Table structure for tool
DROP TABLE IF EXISTS "tool";
CREATE TABLE "tool" (
"id" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"content" TEXT NOT NULL,
"specs" TEXT NOT NULL,
"meta" TEXT NOT NULL,
"created_at" INTEGER NOT NULL,
"updated_at" INTEGER NOT NULL,
"valves" TEXT,
"access_control" JSONB
);
-- Table structure for user
DROP TABLE IF EXISTS "user";
CREATE TABLE "user" (
"id" VARCHAR(255) NOT NULL,
"name" VARCHAR(255) NOT NULL,
"email" VARCHAR(255) NOT NULL,
"role" VARCHAR(255) NOT NULL,
"profile_image_url" TEXT NOT NULL,
"api_key" VARCHAR(255),
"created_at" INTEGER NOT NULL,
"updated_at" INTEGER NOT NULL,
"last_active_at" INTEGER NOT NULL,
"settings" TEXT,
"info" TEXT,
"oauth_sub" TEXT
);
-- Create Indexes
-- auth table indexes
CREATE UNIQUE INDEX "auth_id" ON "auth" ("id");
-- chat table indexes
CREATE UNIQUE INDEX "chat_id" ON "chat" ("id");
CREATE UNIQUE INDEX "chat_share_id" ON "chat" ("share_id");
-- chatidtag table indexes
CREATE UNIQUE INDEX "chatidtag_id" ON "chatidtag" ("id");
-- document table indexes
CREATE UNIQUE INDEX "document_collection_name" ON "document" ("collection_name");
CREATE UNIQUE INDEX "document_name" ON "document" ("name");
-- file table indexes
CREATE UNIQUE INDEX "file_id" ON "file" ("id");
-- function table indexes
CREATE UNIQUE INDEX "function_id" ON "function" ("id");
-- memory table indexes
CREATE UNIQUE INDEX "memory_id" ON "memory" ("id");
-- model table indexes
CREATE UNIQUE INDEX "model_id" ON "model" ("id");
-- prompt table indexes
CREATE UNIQUE INDEX "prompt_command" ON "prompt" ("command");
-- tool table indexes
CREATE UNIQUE INDEX "tool_id" ON "tool" ("id");
-- user table indexes
CREATE UNIQUE INDEX "user_api_key" ON "user" ("api_key");
CREATE UNIQUE INDEX "user_id" ON "user" ("id");
CREATE UNIQUE INDEX "user_oauth_sub" ON "user" ("oauth_sub");
-- Create Foreign Key Constraints (Optional - based on relationships)
-- Channel member references
ALTER TABLE "channel_member" ADD CONSTRAINT "fk_channel_member_channel"
FOREIGN KEY ("channel_id") REFERENCES "channel" ("id") ON DELETE CASCADE;
ALTER TABLE "channel_member" ADD CONSTRAINT "fk_channel_member_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Chat references
ALTER TABLE "chat" ADD CONSTRAINT "fk_chat_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Note: folder reference requires composite foreign key since folder has composite primary key
ALTER TABLE "chat" ADD CONSTRAINT "fk_chat_folder"
FOREIGN KEY ("folder_id", "user_id") REFERENCES "folder" ("id", "user_id") ON DELETE SET NULL;
-- Message references
ALTER TABLE "message" ADD CONSTRAINT "fk_message_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
ALTER TABLE "message" ADD CONSTRAINT "fk_message_channel"
FOREIGN KEY ("channel_id") REFERENCES "channel" ("id") ON DELETE CASCADE;
ALTER TABLE "message" ADD CONSTRAINT "fk_message_parent"
FOREIGN KEY ("parent_id") REFERENCES "message" ("id") ON DELETE CASCADE;
-- Message reaction references
ALTER TABLE "message_reaction" ADD CONSTRAINT "fk_message_reaction_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
ALTER TABLE "message_reaction" ADD CONSTRAINT "fk_message_reaction_message"
FOREIGN KEY ("message_id") REFERENCES "message" ("id") ON DELETE CASCADE;
-- File references
ALTER TABLE "file" ADD CONSTRAINT "fk_file_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Function references
ALTER TABLE "function" ADD CONSTRAINT "fk_function_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Tool references
ALTER TABLE "tool" ADD CONSTRAINT "fk_tool_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Model references
ALTER TABLE "model" ADD CONSTRAINT "fk_model_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Memory references
ALTER TABLE "memory" ADD CONSTRAINT "fk_memory_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Knowledge references
ALTER TABLE "knowledge" ADD CONSTRAINT "fk_knowledge_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Document references
ALTER TABLE "document" ADD CONSTRAINT "fk_document_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Prompt references
ALTER TABLE "prompt" ADD CONSTRAINT "fk_prompt_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Tag references
ALTER TABLE "tag" ADD CONSTRAINT "fk_tag_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Folder references
ALTER TABLE "folder" ADD CONSTRAINT "fk_folder_user"
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE;
-- Note: parent folder reference requires composite foreign key
ALTER TABLE "folder" ADD CONSTRAINT "fk_folder_parent"
FOREIGN KEY ("parent_id", "user_id") REFERENCES "folder" ("id", "user_id") ON DELETE CASCADE;
-- Create indexes for foreign keys to improve performance
CREATE INDEX "idx_channel_member_channel_id" ON "channel_member" ("channel_id");
CREATE INDEX "idx_channel_member_user_id" ON "channel_member" ("user_id");
CREATE INDEX "idx_chat_user_id" ON "chat" ("user_id");
CREATE INDEX "idx_chat_folder_id_user_id" ON "chat" ("folder_id", "user_id");
CREATE INDEX "idx_message_user_id" ON "message" ("user_id");
CREATE INDEX "idx_message_channel_id" ON "message" ("channel_id");
CREATE INDEX "idx_message_parent_id" ON "message" ("parent_id");
CREATE INDEX "idx_message_reaction_user_id" ON "message_reaction" ("user_id");
CREATE INDEX "idx_message_reaction_message_id" ON "message_reaction" ("message_id");
CREATE INDEX "idx_file_user_id" ON "file" ("user_id");
CREATE INDEX "idx_function_user_id" ON "function" ("user_id");
CREATE INDEX "idx_tool_user_id" ON "tool" ("user_id");
CREATE INDEX "idx_model_user_id" ON "model" ("user_id");
CREATE INDEX "idx_memory_user_id" ON "memory" ("user_id");
CREATE INDEX "idx_knowledge_user_id" ON "knowledge" ("user_id");
CREATE INDEX "idx_document_user_id" ON "document" ("user_id");
CREATE INDEX "idx_prompt_user_id" ON "prompt" ("user_id");
CREATE INDEX "idx_tag_user_id" ON "tag" ("user_id");
CREATE INDEX "idx_folder_user_id" ON "folder" ("user_id");
CREATE INDEX "idx_folder_parent_id_user_id" ON "folder" ("parent_id", "user_id");
CREATE OR REPLACE FUNCTION json_array_length(jsonb_data JSONB)RETURNS INTEGER
LANGUAGE plpgsql
IMMUTABLE
AS
functionBEGIN
IF jsonb_data IS NULL THEN
RETURN 0;
END IF;
END;
function;ALTER TABLE "chat"ALTER COLUMN "created_at" TYPE BIGINT USING EXTRACT(EPOCH FROM "created_at")::BIGINT,
ALTER COLUMN "updated_at" TYPE BIGINT USING EXTRACT(EPOCH FROM "updated_at")::BIGINT;
-- 修复 config 表的时间戳字段
ALTER TABLE "config"
ALTER COLUMN "created_at" TYPE BIGINT USING EXTRACT(EPOCH FROM "created_at")::BIGINT,
ALTER COLUMN "updated_at" TYPE BIGINT USING EXTRACT(EPOCH FROM "updated_at")::BIGINT;
-- 修复 migratehistory 表的时间戳字段
ALTER TABLE "migratehistory"
ALTER COLUMN "migrated_at" TYPE BIGINT USING EXTRACT(EPOCH FROM "migrated_at")::BIGINT;`
Logs & Screenshots
字段 "updated_at" 的类型为 bigint, 但表达式的类型为 timestamp without time zone 第 2938 个字符处
2025-07-26 21:04:02 CST 提示: 你需要重写或转换表达式
2025-07-26 21:04:02 CST 语句: UPDATE config SET data='{"ui": {"watermark": "\u8c08\u8d77\u54e5AI", "enable_signup": true, "default_user_role": "pending", "enable_user_webhooks": true, "enable_message_rating": true, "enable_community_sharing": true, "pending_user_overlay_title": "\u4f60\u7684\u8d26\u53f7\u7b49\u5f85\u6fc0\u6d3b", "pending_user_overlay_content": "\u598224\u5c0f\u65f6\u8fd8\u6ca1\u6fc0\u6d3b\uff0c\u8bf7\u8054\u7cfb "}, "auth": {"admin": {"show": true}, "api_key": {"enable": true, "allowed_endpoints": "", "endpoint_restrictions": false}, "jwt_expiry": "-1"}, "ldap": {"enable": false}, "user": {"permissions": {"chat": {"stt": true, "tts": true, "call": false, "edit": true, "share": true, "delete": false, "export": true, "controls": true, "temporary": true, "file_upload": false, "system_prompt": true, "multiple_models": false, "temporary_enforced": false}, "sharing": {"public_tools": false, "public_models": false, "public_prompts": false, "public_knowledge": false}, "features": {"notes": true, "web_search": false, "code_interpreter": true, "image_generation": false, "direct_tool_servers": false}, "workspace": {"tools": false, "models": false, "prompts": false, "knowledge": false}}}, "notes": {"enable": true}, "webui": {"url": "https://xxx"}, "version": 0, "channels": {"enable": false}, "webhook_url": "https://axxx/webhook", "rag": {"template": "### Task:\nRespond to the user query using the provided context, incorporating inline citations in the format [id] only when the tag includes an explicit id attribute (e.g., <source id="1">).\n\n### Guidelines:\n- If you don''t know the answer, clearly state that.\n- If uncertain, ask the user for clarification.\n- Respond in the same language as the user''s query.\n- If the context is unreadable or of poor quality, inform the user and provide the best possible answer.\n- If the answer isn''t present in the context but you possess the knowledge, explain this to the user and provide the answer using your own understanding.\n- Only include inline citations using [id] (e.g., [1], [2]) when the tag includes an id attribute.\n- Do not cite if the tag does not contain an id attribute.\n- Do not use XML tags in your response.\n- Ensure citations are concise and directly related to the information provided.\n\n### Example of Citation:\nIf the user asks about a specific topic and the information is found in a source with a provided id attribute, the response should include the citation like in the following example:\n* "According to the study, the proposed method increases efficiency by 20% [1]."\n\n### Output:\nProvide a clear and direct response to the user''s query, including inline citations in the format [id] only when the tag with id attribute is present in the context.\n\n\n{{CONTEXT}}\n\n\n<user_query>\n{{QUERY}}\n</user_query>\n"}}'::JSON, updated_at='2025-07-26T21:04:02.376784'::timestamp WHERE config.id = 1
Additional Information
初次使用,如有未了解的地方还请见谅