17 lines
486 B
SQL
17 lines
486 B
SQL
DROP TYPE IF EXISTS "IssueStatusMapping" CASCADE;
|
|
CREATE TYPE "IssueStatusMapping" AS ENUM (
|
|
'backlog',
|
|
'selected',
|
|
'in_progress',
|
|
'done'
|
|
);
|
|
ALTER TABLE issues ADD COLUMN status "IssueStatusMapping";
|
|
UPDATE issues
|
|
SET status = issue_statuses.name :: "IssueStatusMapping"
|
|
FROM issue_statuses
|
|
WHERE issue_statuses.id = issues.issue_status_id;
|
|
|
|
ALTER TABLE issues DROP COLUMN issue_status_id;
|
|
ALTER TABLE issues ALTER COLUMN status SET NOT NULL;
|
|
DROP TABLE issue_statuses;
|