"""Added Shop models

Revision ID: 99eaf456280b
Revises: 0894a7be87c8
Create Date: 2017-09-29 07:53:57.506756

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('ShopCategories',
    sa.Column('ShopCategoryID', sa.Integer(), nullable=False),
    sa.Column('Category', sa.String(length=200), nullable=False),
    sa.Column('SubCategory', sa.String(length=200), nullable=False),
    sa.PrimaryKeyConstraint('ShopCategoryID')
    )
    op.create_table('ShopItems',
    sa.Column('ShopItemID', sa.Integer(), nullable=False),
    sa.Column('Title', sa.String(length=200), nullable=False),
    sa.Column('Description', sa.Text(), nullable=True),
    sa.Column('Price', sa.Float(precision=10, asdecimal=True, decimal_return_scale=2), nullable=False),
    sa.Column('Currency', sa.String(length=3), nullable=False),
    sa.Column('Image', sa.String(length=200), nullable=True),
    sa.Column('Created', sa.DateTime(), nullable=True),
    sa.Column('Updated', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('ShopItemID')
    )
    op.create_table('ShopItemsLogos',
    sa.Column('ShopItemLogoID', sa.Integer(), nullable=False),
    sa.Column('Image', sa.String(length=200), nullable=False),
    sa.Column('Created', sa.DateTime(), nullable=True),
    sa.Column('Updated', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('ShopItemLogoID')
    )
    op.create_table('ShopItemsCategoriesMapping',
    sa.Column('ShopItemsCategoriesMappingID', sa.Integer(), nullable=False),
    sa.Column('ShopItemID', sa.Integer(), nullable=False),
    sa.Column('ShopCategoryID', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['ShopCategoryID'], ['ShopCategories.ShopCategoryID'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['ShopItemID'], ['ShopItems.ShopItemID'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('ShopItemsCategoriesMappingID')
    )
    op.create_table('ShopItemsURLMapping',
    sa.Column('ShopItemsURLMappingID', sa.Integer(), nullable=False),
    sa.Column('ShopItemID', sa.Integer(), nullable=False),
    sa.Column('URLTitle', sa.String(length=200), nullable=False),
    sa.Column('URL', sa.Text(), nullable=False),
    sa.Column('ShopItemLogoID', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['ShopItemID'], ['ShopItems.ShopItemID'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['ShopItemLogoID'], ['ShopItemsLogos.ShopItemLogoID'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('ShopItemsURLMappingID')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('ShopItemsURLMapping')
    op.drop_table('ShopItemsCategoriesMapping')
    op.drop_table('ShopItemsLogos')
    op.drop_table('ShopItems')
    op.drop_table('ShopCategories')
    # ### end Alembic commands ###
