"""third migration

Revision ID: 1602b3d0503f
Revises: 45ece2e71b0b
Create Date: 2019-02-27 10:25:14.775717

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '1602b3d0503f'
down_revision = '45ece2e71b0b'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint('comments_user_id_fkey', 'comments', type_='foreignkey')
    op.create_foreign_key(None, 'comments', 'users', ['user_id'], ['id'])
    op.drop_constraint('pitches_pitch_id_fkey', 'pitches', type_='foreignkey')
    op.drop_column('pitches', 'pitch_id')
    op.add_column('users', sa.Column('pitch_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'users', 'pitches', ['pitch_id'], ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'users', type_='foreignkey')
    op.drop_column('users', 'pitch_id')
    op.add_column('pitches', sa.Column('pitch_id', sa.INTEGER(), autoincrement=False, nullable=True))
    op.create_foreign_key('pitches_pitch_id_fkey', 'pitches', 'pitches', ['pitch_id'], ['id'])
    op.drop_constraint(None, 'comments', type_='foreignkey')
    op.create_foreign_key('comments_user_id_fkey', 'comments', 'pitches', ['user_id'], ['id'])
    # ### end Alembic commands ###
