File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
servicex_app/migrations/versions Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ """
2+ Revision ID: v1_7_3
3+ Revises: v1_7_1
4+ Create Date: 2025-10-17
5+
6+ Update transformstatus enum
7+ """
8+
9+ from alembic import op
10+ from sqlalchemy .dialects import postgresql
11+
12+ revision = "v1_7_3"
13+ down_revision = "v1_7_1"
14+ branch_labels = None
15+ depends_on = None
16+
17+
18+ def upgrade ():
19+ with op .get_context ().autocommit_block ():
20+ op .execute ("ALTER TYPE transformstatus ADD VALUE 'bad_dataset'" )
21+
22+
23+ def downgrade ():
24+ op .execute ("UPDATE requests SET status='fatal' WHERE status='bad_dataset'" )
25+ # painful by comparison
26+ old_status_enum_postgres = postgresql .ENUM (
27+ "submitted" ,
28+ "pending_lookup" ,
29+ "lookup" ,
30+ "running" ,
31+ "complete" ,
32+ "fatal" ,
33+ "canceled" ,
34+ name = "transformstatus_" ,
35+ create_type = False ,
36+ )
37+ old_status_enum_postgres .create (op .get_bind (), checkfirst = False )
38+
39+ op .execute (
40+ "alter table requests ALTER COLUMN status TYPE transformstatus_ using status::text::transformstatus_" # noqa;
41+ )
42+ op .execute ("DROP TYPE transformstatus" )
43+ op .execute ("ALTER TYPE transformstatus_ RENAME TO transformstatus" )
You can’t perform that action at this time.
0 commit comments