fix: explicitly create preferencetier enum
Some checks failed
Deploy Fediversion / deploy (push) Failing after 1s

This commit is contained in:
fullsizemalt 2025-12-29 18:36:51 -08:00
parent c4ba926a74
commit ae3741c9ee

View file

@ -44,6 +44,11 @@ def upgrade() -> None:
# 2. Add missing columns to UserVerticalPreference if they don't exist # 2. Add missing columns to UserVerticalPreference if they don't exist
columns = [c['name'] for c in inspector.get_columns('userverticalpreference')] columns = [c['name'] for c in inspector.get_columns('userverticalpreference')]
# Explicitly create type execution for Postgres
from sqlalchemy.dialects import postgresql
enum_type = postgresql.ENUM('HEADLINER', 'MAIN_STAGE', 'SUPPORTING', name='preferencetier')
enum_type.create(op.get_bind(), checkfirst=True)
with op.batch_alter_table('userverticalpreference', schema=None) as batch_op: with op.batch_alter_table('userverticalpreference', schema=None) as batch_op:
if 'tier' not in columns: if 'tier' not in columns:
batch_op.add_column(sa.Column('tier', sa.Enum('HEADLINER', 'MAIN_STAGE', 'SUPPORTING', name='preferencetier'), server_default='MAIN_STAGE', nullable=False)) batch_op.add_column(sa.Column('tier', sa.Enum('HEADLINER', 'MAIN_STAGE', 'SUPPORTING', name='preferencetier'), server_default='MAIN_STAGE', nullable=False))