Skip to content

Commit 92a1485

Browse files
Fix nyxcore enum case — PostgreSQL enum uses uppercase member names
SQLAlchemy stores StrEnum member NAMES (TEXT, UPLOAD, URL) not values (text, upload, url) in PostgreSQL enum types. Previous migration added lowercase 'nyxcore' but needs uppercase 'NYXCORE'. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6744723 commit 92a1485

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

alembic/versions/a1b2c3d4e5f6_add_nyxcore_to_sourcetype_enum.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818

1919
def upgrade() -> None:
20-
op.execute("ALTER TYPE sourcetype ADD VALUE IF NOT EXISTS 'nyxcore'")
20+
# SQLAlchemy stores StrEnum member NAMES (uppercase) in PostgreSQL enum types
21+
op.execute("ALTER TYPE sourcetype ADD VALUE IF NOT EXISTS 'NYXCORE'")
2122

2223

2324
def downgrade() -> None:
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""fix nyxcore enum case — add uppercase NYXCORE
2+
3+
Revision ID: b2c3d4e5f6a7
4+
Revises: a1b2c3d4e5f6
5+
Create Date: 2026-03-18 01:00:00.000000
6+
7+
"""
8+
from collections.abc import Sequence
9+
10+
from alembic import op
11+
12+
# revision identifiers, used by Alembic.
13+
revision: str = "b2c3d4e5f6a7"
14+
down_revision: str | Sequence[str] | None = "a1b2c3d4e5f6"
15+
branch_labels: str | Sequence[str] | None = None
16+
depends_on: str | Sequence[str] | None = None
17+
18+
19+
def upgrade() -> None:
20+
# SQLAlchemy stores StrEnum member NAMES (uppercase) in PostgreSQL enum types.
21+
# Previous migration added lowercase 'nyxcore'; we need uppercase 'NYXCORE'.
22+
op.execute("ALTER TYPE sourcetype ADD VALUE IF NOT EXISTS 'NYXCORE'")
23+
24+
25+
def downgrade() -> None:
26+
pass

0 commit comments

Comments
 (0)