Skip to content

Commit b64af42

Browse files
committed
Add down migration
Also bump migration number since new ones have merged since.
1 parent aba8129 commit b64af42

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

coderd/database/migrations/000338_workspace_app_status_idle.down.sql

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-- It is not possible to delete a value from an enum, so we have to recreate it.
2+
CREATE TYPE old_workspace_app_status_state AS ENUM ('working', 'complete', 'failure');
3+
4+
-- Convert the new "idle" state into "complete". This means we lose some
5+
-- information when downgrading, but this is necessary to swap to the old enum.
6+
UPDATE workspace_app_statuses SET state = 'complete' WHERE state = 'idle';
7+
8+
-- Swap to the old enum.
9+
ALTER TABLE workspace_app_statuses
10+
ALTER COLUMN state TYPE old_workspace_app_status_state
11+
USING (state::text::old_workspace_app_status_state);
12+
13+
-- Drop the new enum and rename the old one to the final name.
14+
DROP TYPE workspace_app_status_state;
15+
ALTER TYPE old_workspace_app_status_state RENAME TO workspace_app_status_state;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy