"""Added Videos model

Revision ID: 0894a7be87c8
Revises: d255000b4aa6
Create Date: 2017-09-25 23:09:13.516907

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '0894a7be87c8'
down_revision = 'd255000b4aa6'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('VideoCategories',
    sa.Column('VideoCategoryID', sa.Integer(), nullable=False),
    sa.Column('Category', sa.String(length=200), nullable=False),
    sa.PrimaryKeyConstraint('VideoCategoryID')
    )
    op.create_table('Videos',
    sa.Column('VideoID', sa.Integer(), nullable=False),
    sa.Column('Title', sa.String(length=200), nullable=False),
    sa.Column('URL', sa.Text(), nullable=False),
    sa.Column('Created', sa.DateTime(), nullable=True),
    sa.Column('Updated', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('VideoID')
    )
    op.create_table('VideosCategoriesMapping',
    sa.Column('VideosCategoriesMappingID', sa.Integer(), nullable=False),
    sa.Column('VideoID', sa.Integer(), nullable=False),
    sa.Column('VideoCategoryID', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['VideoCategoryID'], ['VideoCategories.VideoCategoryID'], ),
    sa.ForeignKeyConstraint(['VideoID'], ['Videos.VideoID'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('VideosCategoriesMappingID')
    )
    # ### end Alembic commands ###


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