-- 1. Add new columns to performance_result
ALTER TABLE "platform_performance"."performance_result"
  ADD COLUMN "self_overall_comment" TEXT,
  ADD COLUMN "manager_overall_comment" TEXT;

-- 2. Migrate existing data from overall_eval_comment
UPDATE "platform_performance"."performance_result" pr
  SET "self_overall_comment" = oec."comment"
  FROM "platform_performance"."overall_eval_comment" oec
  WHERE oec."cycle_id" = pr."cycle_id"
    AND oec."user_id" = pr."employee_id"
    AND oec."role" = 'SELF';

UPDATE "platform_performance"."performance_result" pr
  SET "manager_overall_comment" = oec."comment"
  FROM "platform_performance"."overall_eval_comment" oec
  WHERE oec."cycle_id" = pr."cycle_id"
    AND oec."user_id" = pr."employee_id"
    AND oec."role" = 'MANAGER';

-- 3. Drop overall_eval_comment table

-- 4. Drop EvalCommentRole enum
DROP TYPE IF EXISTS "platform_performance"."EvalCommentRole";
