create index if not exists idx_submissions_user_assessment_time
  on submissions(user_id, assessment_id, submitted_at desc);

create index if not exists idx_submissions_assessment_time
  on submissions(assessment_id, submitted_at desc);

create index if not exists idx_reports_created_at
  on reports(created_at desc);

create index if not exists idx_reports_submission_id
  on reports(submission_id);

create index if not exists idx_answers_submission_id
  on answers(submission_id);

create index if not exists idx_invitation_codes_lower_code
  on invitation_codes(lower(code));
