ALTER TABLE "issues"
    ALTER COLUMN "issue_type"
        SET DATA TYPE TEXT
        USING "issue_type"::TEXT;

DROP TYPE IF EXISTS "IssueType" CASCADE;
CREATE TYPE "IssueType" AS ENUM (
    'task',
    'bug',
    'story',
    'epic'
    );

ALTER TABLE "issues"
    ALTER COLUMN "issue_type"
        SET DATA TYPE "IssueType"
        USING "issue_type"::"IssueType";

ALTER TABLE "issues" DROP COLUMN "epic_id";

DROP TABLE IF EXISTS epics;
