alter table {schema}.activities
    drop constraint if exists activities_status_valid;

update {schema}.activities
set status = case
    when status in ('open', 'in_progress') then 'active'
    else 'inactive'
end
where status in ('open', 'in_progress', 'done', 'cancelled');

alter table {schema}.activities
    alter column status set default 'active';

alter table {schema}.activities
    add constraint activities_status_valid check (status in ('active', 'inactive'));
