Files
ten31-database/backend/migrations/0001_phase0_foundation.down.sql
Keysat c7ce44d963 Phase 0 foundation: canonical schema, ingest pipeline, CRM MCP server
Workstream A–C substrate for the Ten31 agentic system:
- A1: docs/crm-overview.md; CLAUDE.md conventions + guardrail #9
- A2: additive/reversible core migration (canonical_entities, entity_links,
  interaction_log, relationship_edges, soft-delete) + ledgered runner
- B1/B3: chunking + deterministic entity resolution (backend/ingest)
- B2: dense (bge-m3) + BM25 sparse ingest to Qdrant crm_chunks
- C: CRM MCP server (reads, retrieval modes, logged writes) — no outbound tools
- docs: redaction/re-hydration, Gmail enablement runbook
- synthetic test data; .env.example; housekeeping (.gitignore, untrack crm.db,
  drop legacy files + start9/0.3.5)

Verified end-to-end on synthetic data + live Sparks (hybrid > dense on entity
queries). Real backfill runs on Ten31 infra; index holds synthetic data only.
Branch snapshot also captures pre-existing working-tree changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 08:13:35 -05:00

24 lines
1.1 KiB
SQL

-- Reversal of 0001_phase0_foundation.sql.
--
-- Run manually (it is NOT applied automatically) if the Phase-0 foundation
-- schema needs to be rolled back. Drops the new tables. The added `deleted_at`
-- columns on existing tables are left in place by default because they are
-- inert (nullable, unused unless the DELETE handlers are changed) and dropping
-- columns requires SQLite >= 3.35; uncomment the DROP COLUMN lines to remove
-- them on a modern SQLite.
DROP TABLE IF EXISTS relationship_edges;
DROP TABLE IF EXISTS interaction_log;
DROP TABLE IF EXISTS entity_links;
DROP TABLE IF EXISTS canonical_entities;
-- Requires SQLite >= 3.35.0. Safe to leave the columns if unsure.
-- ALTER TABLE contacts DROP COLUMN deleted_at;
-- ALTER TABLE organizations DROP COLUMN deleted_at;
-- ALTER TABLE opportunities DROP COLUMN deleted_at;
-- ALTER TABLE communications DROP COLUMN deleted_at;
-- ALTER TABLE lp_profiles DROP COLUMN deleted_at;
-- Forget the migration so it can be re-applied:
DELETE FROM schema_migrations WHERE filename = '0001_phase0_foundation.sql';