"""Added affils table and the association table to the authors

Revision ID: 81f19346795f
Revises: 0b2a4b93c600
Create Date: 2018-05-30 17:00:54.055673

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '81f19346795f'
down_revision = '0b2a4b93c600'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('affils',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(), nullable=True),
    sa.Column('city', sa.String(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('author_affil_table',
    sa.Column('author_id', sa.Integer(), nullable=True),
    sa.Column('affil_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['affil_id'], ['affils.id'], ),
    sa.ForeignKeyConstraint(['author_id'], ['authors.id'], )
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('author_affil_table')
    op.drop_table('affils')
    # ### end Alembic commands ###
