Summary: - Fix pg-boss queue conflict (duplicate key violation on queue_pkey) - Add global error listener to prevent process crash - Reduce connection pool from 10 to 4 - Add graceful shutdown handling (SIGTERM/SIGINT) - Fix researchWorker recursive call bug in catch block - Make screeningWorker idempotent using upsert Security Standards (v1.1): - Prohibit recursive retry in Worker catch blocks - Prohibit payload bloat (only store fileKey/ID in job.data) - Require Worker idempotency (upsert + unique constraint) - Recommend task-specific expireInSeconds settings - Document graceful shutdown pattern New Features: - PKB signed URL endpoint for document preview/download - pg_bigm installation guide for Docker - Dockerfile.postgres-with-extensions for pgvector + pg_bigm Documentation: - Update Postgres-Only async task processing guide (v1.1) - Add troubleshooting SQL queries - Update safety checklist Tested: Local verification passed
71 lines
841 B
SQL
71 lines
841 B
SQL
-- 在 platform_schema.users 中创建 mock 用户
|
|
-- 用于 PKB 等模块的测试
|
|
|
|
-- 首先需要一个默认租户
|
|
INSERT INTO platform_schema.tenants (id, code, name, type, status, created_at, updated_at)
|
|
VALUES (
|
|
'tenant-mock-001',
|
|
'mock-tenant',
|
|
'测试租户',
|
|
'INTERNAL',
|
|
'ACTIVE',
|
|
NOW(),
|
|
NOW()
|
|
)
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
-- 创建 mock 用户
|
|
INSERT INTO platform_schema.users (
|
|
id,
|
|
phone,
|
|
email,
|
|
password,
|
|
is_default_password,
|
|
name,
|
|
role,
|
|
status,
|
|
tenant_id,
|
|
kb_quota,
|
|
kb_used,
|
|
is_trial,
|
|
created_at,
|
|
updated_at
|
|
)
|
|
VALUES (
|
|
'user-mock-001',
|
|
'13800000000',
|
|
'mock@test.com',
|
|
'$2b$10$mockhashedpassword123456789',
|
|
true,
|
|
'测试用户',
|
|
'USER',
|
|
'active',
|
|
'tenant-mock-001',
|
|
3,
|
|
0,
|
|
false,
|
|
NOW(),
|
|
NOW()
|
|
)
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|