-- Convert request_type and request_category columns to enums

-- create enum types
create type request_type as enum (
  'Install',
  'Repair',
  'Upgrade',
  'Replace',
  'Other'
);

create type request_category as enum (
  'Software',
  'Hardware',
  'Network'
);

-- alter existing columns to use the enum types
alter table tasks
  alter column request_type type request_type using (
    case when request_type is null then null else request_type::request_type end
  ),
  alter column request_category type request_category using (
    case when request_category is null then null else request_category::request_category end
  );
