Files
Ydisks-Xianyu-Helper/internal/db/migrations/postgres/00034_ai_bargain_auto_price.sql
T
Christ 50eca2fca6 修复:完善上传契约与自动化闭环
统一 multipart 请求透传并补齐接口契约和边界校验;新增 AI 自动改价、暂时性失败重试、擦亮与确认发货幂等处理;修复聊天已读回执跨端同步误报警,并更新前端静态资源与回归测试。
2026-08-20 19:03:29 +08:00

28 lines
950 B
SQL

-- +goose Up
ALTER TABLE ai_reply_settings
ADD COLUMN auto_adjust_price_enabled INTEGER NOT NULL DEFAULT 0;
CREATE TABLE ai_bargain_quotes (
id BIGSERIAL PRIMARY KEY,
cookie_id TEXT NOT NULL REFERENCES cookies(id) ON DELETE CASCADE,
chat_id TEXT NOT NULL,
buyer_id TEXT NOT NULL,
item_id TEXT NOT NULL,
price_cents BIGINT NOT NULL,
status TEXT NOT NULL DEFAULT 'pending',
order_id TEXT,
expires_at BIGINT NOT NULL,
error_message TEXT NOT NULL DEFAULT '',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UNIQUE (cookie_id, order_id)
);
CREATE INDEX idx_ai_bargain_quotes_pending
ON ai_bargain_quotes(cookie_id, buyer_id, item_id, chat_id, status, expires_at, id);
-- +goose Down
DROP INDEX IF EXISTS idx_ai_bargain_quotes_pending;
DROP TABLE IF EXISTS ai_bargain_quotes;
ALTER TABLE ai_reply_settings DROP COLUMN auto_adjust_price_enabled;