The column was added to the create_table migration after it had already been applied, so the live DB was missing it. This new migration adds the column and index separately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
30 lines
742 B
Python
30 lines
742 B
Python
"""Add device_id column to oauth_grants
|
|
|
|
Revision ID: r8p6m2n4o5
|
|
Revises: q7o5l1m3n4
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision = "r8p6m2n4o5"
|
|
down_revision = "q7o5l1m3n4"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# device_id was added to the create_table migration after it had already
|
|
# run, so the column is missing from the live DB. Add it now.
|
|
op.add_column(
|
|
"oauth_grants",
|
|
sa.Column("device_id", sa.String(128), nullable=True),
|
|
)
|
|
op.create_index(
|
|
"ix_oauth_grant_device", "oauth_grants", ["device_id", "client_id"]
|
|
)
|
|
|
|
|
|
def downgrade():
|
|
op.drop_index("ix_oauth_grant_device", table_name="oauth_grants")
|
|
op.drop_column("oauth_grants", "device_id")
|