-- Minimal schema v1

create table if not exists events (
  event_id text primary key,
  ts timestamptz not null,
  type text not null,
  session_id text null,
  run_id text null,
  trace_id text null,
  span_id text null,
  parent_span_id text null,
  source_framework text null,
  client_id text null,
  payload jsonb not null
);

create index if not exists events_ts_idx on events (ts);
create index if not exists events_session_idx on events (session_id);
create index if not exists events_run_idx on events (run_id);
create index if not exists events_type_ts_idx on events (type, ts);
