-- color configuration general fixes
alter table color_configuration
    add column request_add_color VARCHAR(255);
alter table color_configuration
    add column request_remove_color VARCHAR(255);
alter table color_configuration
    add column recommendation_color VARCHAR(255);
alter table color_configuration
    add column skipped_color VARCHAR(255);
alter table color_configuration
    add column redaction_color VARCHAR(255);
alter table color_configuration
    add column hint_color VARCHAR(255);

update color_configuration
set request_add_color = request_add;
update color_configuration
set request_remove_color = request_remove;
update color_configuration
set skipped_color = not_redacted;
update color_configuration
set redaction_color = preview_color;
update color_configuration
set hint_color = '#fa98f7'; -- UI Hardcoded value
update color_configuration
set recommendation_color = '#c5d3eb'; -- UI Hardcoded value

alter table color_configuration
    drop column manual_redaction_color;
alter table color_configuration
    drop column request_add;
alter table color_configuration
    drop column request_remove;
alter table color_configuration
    drop column not_redacted;

-- update color values for existing
update entity e
set recommendation_hex_color = (select recommendation_color from color_configuration c where c.dossier_template_id = e.dossier_template_id)
where recommendation_hex_color is null;
update entity e
set skipped_hex_color = '#ec9090'
where e.dossier_id is not null;
