Files
Agent-System/deploy/postgres/goose/00003_2026-09-09-uq-context-memory-chunk-hash.sql
T
weichen 3145550a59 feat(security): complete P0 release blocking remediation
Unify auth middleware and remove X-User-ID trust, add project_members
authorization, sandbox workspaces via resolver, and admin-only reconcile
by run_id. Introduce goose migrations with startup schema gate, fail closed
when DB unavailable outside explicit ALLOW_IN_MEMORY, bundle web/dist in
app Dockerfile, and remove frontend pseudo-login fallback.
2026-09-13 02:50:22 +00:00

16 lines
519 B
SQL

-- +goose Up
-- 修复 IndexApprovedDocument: ON CONFLICT (chunk_hash) 需要唯一约束
DELETE FROM context_memory_chunks a
USING context_memory_chunks b
WHERE a.chunk_hash IS NOT NULL
AND a.chunk_hash <> ''
AND a.chunk_hash = b.chunk_hash
AND a.id > b.id;
UPDATE context_memory_chunks
SET chunk_hash = 'legacy_empty_' || id::text
WHERE chunk_hash IS NULL OR chunk_hash = '';
DROP INDEX IF EXISTS idx_mem_chunks_hash;
CREATE UNIQUE INDEX IF NOT EXISTS uq_mem_chunks_hash ON context_memory_chunks(chunk_hash);