create table if not exists meetings (
  id text primary key,
  org_id text not null,
  started_at timestamptz default now(),
  ended_at timestamptz
);

create table if not exists events (
  id bigserial primary key,
  org_id text not null,
  meeting_id text not null,
  room_id text not null,
  type text not null,             -- ingest.transcript|ingest.chat|participant.join|...
  ts timestamptz not null,
  room_seq bigint not null,
  meet_seq bigint not null,
  source text not null,
  payload jsonb not null
);
create index if not exists idx_events_meeting_ts on events(meeting_id, ts);
create index if not exists idx_events_room on events(meeting_id, room_id, room_seq);
