"""add fields to github_admin_app_token

Revision ID: 63033c01def0
Revises: f92f99aa6fdd
Create Date: 2020-12-25 13:51:10.399740

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '63033c01def0'
down_revision = 'f92f99aa6fdd'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('github_admin_app_token', schema=None) as batch_op:
        batch_op.add_column(sa.Column('scope', sa.Text(), nullable=True))
        batch_op.add_column(sa.Column('user_id', sa.Integer(), nullable=False))
        batch_op.create_foreign_key(None, 'github_users', ['user_id'], ['user_id'])

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('github_admin_app_token', schema=None) as batch_op:
        batch_op.drop_constraint(None, type_='foreignkey')
        batch_op.drop_column('user_id')
        batch_op.drop_column('scope')

    # ### end Alembic commands ###
