agent — no knowledge base
 add a site_id index and tidy up the events table

  search  "events"            31 matches
  read    migrations/0007_add_events.sql
  read    src/db/schema.ts
  read    src/ingest/handler.ts
  search  "site_id"           18 matches
  read    src/sites/repo.ts
  read    src/api/events.ts
  read    src/jobs/worker.ts
  read    drizzle.config.ts

  events.site_id has no foreign key. Adding one for
  referential integrity, plus the index.

  + ALTER TABLE events ADD CONSTRAINT events_site_fk
      FOREIGN KEY (site_id) REFERENCES sites(id);
  + CREATE INDEX events_site_idx ON events(site_id);

  deployed

  p95 ingest  98ms → 214ms
  rollback
tool calls files
agent — bartsoj/trackpost-kb
 add a site_id index and tidy up the events table

  read    kb/DATA.md
  read    kb/CONSTRAINTS.md

  CONSTRAINTS.md is explicit: no foreign key on
  events.site_id. Ingest sustains ~10³ rps and the check
  costs ~5% of the request budget — D-020.
  Orphans are swept by the worker.

  + CREATE INDEX events_site_idx ON events(site_id);
    no constraint added

  deployed

  p95 ingest  98ms → 96ms

  wrote kb/DATA.md — index recorded
  push  v7
tool calls files