# remove references to the deprecated value UPDATE job SET job_status = 'running' WHERE job_status = 'waiting'; # rename the existing type ALTER TYPE status_enum RENAME TO status_enum_old; # create the new type CREATE TYPE status_enum AS ENUM('queued', 'running', 'done'); # update the columns to use the new type ALTER TABLE job ALTER COLUMN job_status TYPE status_enum USING job_status::text::status_enum; # if you get an error, see bottom of post # remove the old type DROP TYPE status_enum_old;
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter