Skip to content

Commit 9681f92

Browse files
committed
Add 0546_update_permissions_type_enum
This adds send_files_via_ui to the permissions_type enum
1 parent 5685b9c commit 9681f92

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

migrations/.current-alembic-head

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0545_add_pending_column
1+
0546_update_permissions_enum
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""
2+
Create Date: 2026-03-19 11:15:54.687868
3+
"""
4+
5+
from alembic import op
6+
from sqlalchemy import text
7+
8+
revision = '0546_update_permissions_enum'
9+
down_revision = '0545_add_pending_column'
10+
11+
12+
def upgrade():
13+
conn = op.get_bind()
14+
conn.execute(text("SET lock_timeout = '1s'"))
15+
conn.execute(text("SET statement_timeout = '5s'"))
16+
17+
# This will only run if send_files_via_ui is not present as an enum label
18+
stmt = "Select 1 from pg_enum as e JOIN pg_type as t ON e.enumtypid=t.oid WHERE e.enumlabel='send_files_via_ui' and t.typname='permission_types'"
19+
exists = conn.execute(text(stmt)).scalar_one_or_none()
20+
21+
if not exists:
22+
conn.execute(text("ALTER TYPE permission_types ADD VALUE 'send_files_via_ui'"))
23+
24+
25+
def downgrade():
26+
pass

0 commit comments

Comments
 (0)