"""Added the 'image' tables.

Revision ID: 23e928dda837
Revises: 1ee62841eb90
Create Date: 2019-12-17 07:15:55.472022

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '23e928dda837'
down_revision = '1ee62841eb90'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('publisher_image',
    sa.Column('publ_id', sa.Integer(), nullable=False),
    sa.Column('image_filename', sa.String(length=500), nullable=False),
    sa.Column('image_data', sa.LargeBinary(), nullable=False),
    sa.ForeignKeyConstraint(['publ_id'], ['publisher.publ_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('publ_id')
    )
    op.create_table('publication_image',
    sa.Column('pub_id', sa.Integer(), nullable=False),
    sa.Column('image_filename', sa.String(length=500), nullable=False),
    sa.Column('image_data', sa.LargeBinary(), nullable=False),
    sa.ForeignKeyConstraint(['pub_id'], ['publication.pub_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('pub_id')
    )
    op.create_table('article_image',
    sa.Column('article_id', sa.Integer(), nullable=False),
    sa.Column('image_filename', sa.String(length=500), nullable=False),
    sa.Column('image_data', sa.LargeBinary(), nullable=False),
    sa.ForeignKeyConstraint(['article_id'], ['article.article_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('article_id')
    )
    # ### end Alembic commands ###


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