"""Added Photos model

Revision ID: f4e69bc6b067
Revises: 99eaf456280b
Create Date: 2017-10-03 21:48:37.498156

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'f4e69bc6b067'
down_revision = '99eaf456280b'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('PhotoAlbums',
    sa.Column('AlbumID', sa.Integer(), nullable=False),
    sa.Column('Title', sa.String(length=200), nullable=False),
    sa.Column('Created', sa.DateTime(), nullable=True),
    sa.Column('Updated', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('AlbumID')
    )
    op.create_table('PhotoCategories',
    sa.Column('PhotoCategoryID', sa.Integer(), nullable=False),
    sa.Column('Category', sa.String(length=200), nullable=False),
    sa.PrimaryKeyConstraint('PhotoCategoryID')
    )
    op.create_table('Photos',
    sa.Column('PhotoID', sa.Integer(), nullable=False),
    sa.Column('Image', sa.String(length=255), nullable=False),
    sa.Column('Caption', sa.Text(), nullable=True),
    sa.Column('TakenBy', sa.String(length=200), nullable=True),
    sa.Column('Country', sa.String(length=100), nullable=True),
    sa.Column('CountryCode', sa.String(length=2), nullable=True),
    sa.Column('City', sa.String(length=100), nullable=True),
    sa.Column('Created', sa.DateTime(), nullable=True),
    sa.Column('Updated', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('PhotoID')
    )
    op.create_table('PhotosAlbumsMapping',
    sa.Column('PhotosAlbumsMappingID', sa.Integer(), nullable=False),
    sa.Column('PhotoID', sa.Integer(), nullable=True),
    sa.Column('AlbumID', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['AlbumID'], ['PhotoAlbums.AlbumID'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['PhotoID'], ['Photos.PhotoID'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('PhotosAlbumsMappingID')
    )
    op.create_table('PhotosCategoriesMapping',
    sa.Column('PhotosCategoriesMappingID', sa.Integer(), nullable=False),
    sa.Column('PhotoID', sa.Integer(), nullable=True),
    sa.Column('PhotoCategoryID', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['PhotoCategoryID'], ['PhotoCategories.PhotoCategoryID'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['PhotoID'], ['Photos.PhotoID'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('PhotosCategoriesMappingID')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('PhotosCategoriesMapping')
    op.drop_table('PhotosAlbumsMapping')
    op.drop_table('Photos')
    op.drop_table('PhotoCategories')
    op.drop_table('PhotoAlbums')
    # ### end Alembic commands ###
