This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/data/migrations/versions/1d2d86d09fcd_actually_remove_the_column.py
2015-10-24 15:00:19 -04:00

36 lines
1.2 KiB
Python

"""Actually remove the column access_token_id
Revision ID: 1d2d86d09fcd
Revises: 14fe12ade3df
Create Date: 2015-02-12 16:27:30.260797
"""
# revision identifiers, used by Alembic.
revision = '1d2d86d09fcd'
down_revision = '14fe12ade3df'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.exc import InternalError
def upgrade(tables):
### commands auto generated by Alembic - please adjust! ###
try:
op.drop_constraint(u'fk_logentry_access_token_id_accesstoken', 'logentry', type_='foreignkey')
op.drop_index('logentry_access_token_id', table_name='logentry')
op.drop_column('logentry', 'access_token_id')
except InternalError:
pass
### end Alembic commands ###
def downgrade(tables):
### commands auto generated by Alembic - please adjust! ###
try:
op.add_column('logentry', sa.Column('access_token_id', sa.Integer(), nullable=True))
op.create_foreign_key(u'fk_logentry_access_token_id_accesstoken', 'logentry', 'accesstoken', ['access_token_id'], ['id'])
op.create_index('logentry_access_token_id', 'logentry', ['access_token_id'], unique=False)
except InternalError:
pass
### end Alembic commands ###