Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

34 рядки
1.9KB

  1. <%
  2. '=======================================================================================================================
  3. ' MIGRATION: create_embedding_index_table
  4. '=======================================================================================================================
  5. ' Bookkeeping for semantic (vector) indexing (spec FR-008): one row per indexed memory or chunk. The vectors live in
  6. ' the vector store (Qdrant, derived data); this table records what should be there, for which revision, with which
  7. ' model/dimensions, and whether it succeeded, so a failed or stale index can always be rebuilt from SQLite.
  8. ' status: pending (needs embedding), indexed, failed (attempts counts retries), delete (point must be removed)
  9. '-----------------------------------------------------------------------------------------------------------------------
  10. Sub Migration_Up(migration)
  11. migration.ExecuteSQL "CREATE TABLE embedding_index (" & _
  12. "target_kind TEXT NOT NULL CHECK (target_kind IN ('memory','chunk')), " & _
  13. "target_id TEXT NOT NULL, " & _
  14. "tenant_id TEXT NOT NULL, " & _
  15. "namespace_id TEXT NOT NULL, " & _
  16. "revision INTEGER NOT NULL, " & _
  17. "status TEXT NOT NULL CHECK (status IN ('pending','indexed','failed','delete')), " & _
  18. "model TEXT, " & _
  19. "dimensions INTEGER, " & _
  20. "attempts INTEGER NOT NULL DEFAULT 0, " & _
  21. "error TEXT, " & _
  22. "updated_at TEXT NOT NULL, " & _
  23. "PRIMARY KEY (target_kind, target_id))"
  24. migration.CreateIndex "idx_embedding_index_status", "embedding_index", "status, tenant_id"
  25. migration.CreateIndex "idx_embedding_index_tenant", "embedding_index", "tenant_id"
  26. End Sub
  27. Sub Migration_Down(migration)
  28. migration.DropIndex "idx_embedding_index_tenant", "embedding_index"
  29. migration.DropIndex "idx_embedding_index_status", "embedding_index"
  30. migration.DropTable "embedding_index"
  31. End Sub
  32. %>

Powered by TurnKey Linux.