central/sql/migrations/014_events_time_id_index.sql
Matt Johnson 9f3794f4ff feat(api): add paginated events feed JSON endpoint
GET /events.json with cursor-based pagination and filtering:
- Filter by adapter, category, since/until, region bbox
- Cursor pagination via (time DESC, id DESC) ordering
- Returns events with GeoJSON geometry parsed as objects
- Validation returns 400 with clear error messages

Migration 014 adds composite index for efficient pagination.

Tests: 17 new tests covering filters, pagination, validation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-18 04:21:18 +00:00

5 lines
228 B
SQL

-- Migration 014: Add composite index for cursor-based pagination
-- Supports ORDER BY (time DESC, id DESC) with efficient range queries
CREATE INDEX IF NOT EXISTS events_time_id_desc_idx
ON public.events (time DESC, id DESC);