Files
evo-sync/web/migrations/versions/f6a7b8c9d0e1_evotor_webhook_token_flow.py

33 lines
1.0 KiB
Python
Raw Normal View History

"""evotor webhook token flow: add evotor_user_id, make user_id nullable
Revision ID: f6a7b8c9d0e1
Revises: e5f6a7b8c9d0
Branch Labels: None
Depends On: None
"""
from alembic import op
import sqlalchemy as sa
revision = 'f6a7b8c9d0e1'
down_revision = 'e5f6a7b8c9d0'
branch_labels = None
depends_on = None
def upgrade() -> None:
op.add_column('evotor_connections',
sa.Column('evotor_user_id', sa.String(255), nullable=True))
op.create_unique_constraint('uq_evotor_connections_evotor_user_id',
'evotor_connections', ['evotor_user_id'])
op.create_index('ix_evotor_connections_evotor_user_id',
'evotor_connections', ['evotor_user_id'])
op.alter_column('evotor_connections', 'user_id', nullable=True)
def downgrade() -> None:
op.alter_column('evotor_connections', 'user_id', nullable=False)
op.drop_index('ix_evotor_connections_evotor_user_id', 'evotor_connections')
op.drop_constraint('uq_evotor_connections_evotor_user_id', 'evotor_connections')
op.drop_column('evotor_connections', 'evotor_user_id')