› 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