-- AlterTable
ALTER TABLE "tasks" ADD COLUMN "detailDescription" TEXT;

-- 기존 description(첫 줄=개요, 이후=상세) → 분리 (실행과제·프로젝트만)
UPDATE "tasks"
SET
  "detailDescription" = CASE
    WHEN position(E'\n' in "description") > 0
    THEN NULLIF(trim(substring("description" from position(E'\n' in "description") + 1)), '')
    ELSE NULL
  END,
  "description" = NULLIF(trim(split_part("description", E'\n', 1)), '')
WHERE "description" IS NOT NULL
  AND trim("description") != ''
  AND ("taskType" = '실행과제' OR "taskType" = '프로젝트');
