Add migration for device_id column on oauth_grants
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>
This commit is contained in:
29
alembic/versions/r8p6m2n4o5_add_device_id_to_oauth_grants.py
Normal file
29
alembic/versions/r8p6m2n4o5_add_device_id_to_oauth_grants.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
"""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")
|
||||||
Reference in New Issue
Block a user