bitque/migrations/2020-08-10-194809_change_epic/up.sql

34 lines
834 B
MySQL
Raw Normal View History

2020-08-10 22:34:19 +02:00
ALTER TABLE "issues"
ALTER COLUMN "issue_type"
SET DATA TYPE TEXT
USING "issue_type"::TEXT;
UPDATE "issues"
SET "issue_type" = 'task'
WHERE "issue_type" = 'epic';
2023-04-01 22:31:57 +02:00
DROP TYPE IF EXISTS "IssueTypeMapping" CASCADE;
CREATE TYPE "IssueTypeMapping" AS ENUM (
2020-08-10 22:34:19 +02:00
'task',
'bug',
'story'
);
ALTER TABLE "issues"
ALTER COLUMN "issue_type"
2023-04-01 22:31:57 +02:00
SET DATA TYPE "IssueTypeMapping"
USING "issue_type"::"IssueTypeMapping";
2020-08-10 22:34:19 +02:00
CREATE TABLE epics (
id serial primary key not null,
name text not null,
user_id integer not null references users (id),
project_id integer not null references projects (id),
created_at timestamp not null default now(),
updated_at timestamp not null default now()
);
ALTER TABLE "issues"
ADD COLUMN "epic_id" integer
REFERENCES "epics" ( "id" ) NULL;