mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-07-13 17:09:53 +00:00
9f77bfe711
Vault rescan redesigned from per-agent to tenant-wide:
- POST /v1/vault/rescan replaces POST /v1/agents/{id}/vault/rescan
- agent_id nullable in vault_documents (PG migration 046 + SQLite v14)
- Path-based scope inference: agents/{key}/ → personal, teams/{uuid}/ → team, root → shared
- Interceptor sets agent_id=NULL for team-scoped file writes
- Enrichment worker batch key handles empty agent_id
- web-fetch/ directory excluded from vault scan at any depth
- Media preview: images render via authenticated blob URL, binary files show metadata
- Scan button no longer requires agent selection
19 lines
879 B
SQL
19 lines
879 B
SQL
-- Revert: delete orphaned docs, restore NOT NULL + CASCADE.
|
|
DELETE FROM vault_documents WHERE agent_id IS NULL;
|
|
|
|
ALTER TABLE vault_documents ALTER COLUMN agent_id SET NOT NULL;
|
|
|
|
ALTER TABLE vault_documents DROP CONSTRAINT vault_documents_agent_id_fkey;
|
|
ALTER TABLE vault_documents ADD CONSTRAINT vault_documents_agent_id_fkey
|
|
FOREIGN KEY (agent_id) REFERENCES agents(id) ON DELETE CASCADE;
|
|
|
|
DROP INDEX IF EXISTS uq_vault_docs_agent_team_scope_path;
|
|
CREATE UNIQUE INDEX uq_vault_docs_agent_team_scope_path
|
|
ON vault_documents (agent_id, COALESCE(team_id, '00000000-0000-0000-0000-000000000000'), scope, path);
|
|
|
|
DROP TRIGGER IF EXISTS trg_vault_docs_agent_null_scope ON vault_documents;
|
|
DROP FUNCTION IF EXISTS vault_docs_agent_null_scope_fix();
|
|
|
|
DROP INDEX IF EXISTS idx_vault_docs_agent_scope;
|
|
CREATE INDEX idx_vault_docs_agent_scope ON vault_documents(agent_id, scope);
|