Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add down migration
Also bump migration number since new ones have merged since.
  • Loading branch information
code-asher committed Jun 20, 2025
commit b64af42bc8bc693693b4a0a39ee94cf4f33dbcb0

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- It is not possible to delete a value from an enum, so we have to recreate it.
CREATE TYPE old_workspace_app_status_state AS ENUM ('working', 'complete', 'failure');

-- Convert the new "idle" state into "complete". This means we lose some
-- information when downgrading, but this is necessary to swap to the old enum.
UPDATE workspace_app_statuses SET state = 'complete' WHERE state = 'idle';

-- Swap to the old enum.
ALTER TABLE workspace_app_statuses
ALTER COLUMN state TYPE old_workspace_app_status_state
USING (state::text::old_workspace_app_status_state);

-- Drop the new enum and rename the old one to the final name.
DROP TYPE workspace_app_status_state;
ALTER TYPE old_workspace_app_status_state RENAME TO workspace_app_status_state;
Loading