alter table public.tasks
  add column if not exists request_key uuid;

alter table public.submissions
  add column if not exists request_key uuid;

create unique index if not exists tasks_request_key_key
  on public.tasks (request_key)
  where request_key is not null;

create unique index if not exists submissions_request_key_key
  on public.submissions (request_key)
  where request_key is not null;

create unique index if not exists projects_company_normalized_name_key
  on public.projects (company_id, lower(btrim(name)));
