"""Initial migration.

Revision ID: 55a773b3c00a
Revises: 
Create Date: 2020-11-13 17:38:32.087513

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '55a773b3c00a'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('Brand',
    sa.Column('brandid', sa.Integer(), nullable=False),
    sa.Column('brandname', sa.String(length=120), nullable=False),
    sa.PrimaryKeyConstraint('brandid')
    )
    op.create_table('Category',
    sa.Column('categoryid', sa.Integer(), nullable=False),
    sa.Column('categoryname', sa.String(length=120), nullable=False),
    sa.PrimaryKeyConstraint('categoryid')
    )
    op.create_table('Color',
    sa.Column('colorid', sa.Integer(), nullable=False),
    sa.Column('colorhexval', sa.String(length=120), nullable=False),
    sa.Column('colorname', sa.String(length=120), nullable=False),
    sa.PrimaryKeyConstraint('colorid')
    )
    op.create_table('ProductType',
    sa.Column('typeid', sa.Integer(), nullable=False),
    sa.Column('typename', sa.String(length=120), nullable=False),
    sa.PrimaryKeyConstraint('typeid')
    )
    op.create_table('Tag',
    sa.Column('tagid', sa.Integer(), nullable=False),
    sa.Column('tagname', sa.String(length=120), nullable=False),
    sa.PrimaryKeyConstraint('tagid')
    )
    op.create_table('Product',
    sa.Column('productid', sa.Integer(), nullable=False),
    sa.Column('productname', sa.String(), nullable=False),
    sa.Column('price', sa.Float(), nullable=True),
    sa.Column('productlink', sa.String(), nullable=True),
    sa.Column('rating', sa.Float(), nullable=True),
    sa.Column('description', sa.String(), nullable=True),
    sa.Column('categoryid', sa.Integer(), nullable=True),
    sa.Column('producttypeid', sa.Integer(), nullable=True),
    sa.Column('brandid', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['brandid'], ['Brand.brandid'], ),
    sa.ForeignKeyConstraint(['categoryid'], ['Category.categoryid'], ),
    sa.ForeignKeyConstraint(['producttypeid'], ['ProductType.typeid'], ),
    sa.PrimaryKeyConstraint('productid')
    )
    op.create_table('ProductColorMap',
    sa.Column('productid', sa.Integer(), nullable=True),
    sa.Column('colorid', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['colorid'], ['Color.colorid'], ),
    sa.ForeignKeyConstraint(['productid'], ['Product.productid'], )
    )
    op.create_table('ProductTagMap',
    sa.Column('productid', sa.Integer(), nullable=True),
    sa.Column('tagid', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['productid'], ['Product.productid'], ),
    sa.ForeignKeyConstraint(['tagid'], ['Tag.tagid'], )
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('ProductTagMap')
    op.drop_table('ProductColorMap')
    op.drop_table('Product')
    op.drop_table('Tag')
    op.drop_table('ProductType')
    op.drop_table('Color')
    op.drop_table('Category')
    op.drop_table('Brand')
    # ### end Alembic commands ###
