"""Initial migration
Revision ID: ddd86f253887
Revises: 
Create Date: 2021-08-07 21:53:08.502496
"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('positions',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('role', sa.String(length=64), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('role')
    )
    op.create_table('products',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('product_name', sa.String(length=64), nullable=False),
    sa.Column('description', sa.Text(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_products_product_name'), 'products', ['product_name'], unique=True)
    op.create_table('employers',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=28), nullable=False),
    sa.Column('email', sa.String(length=128), nullable=False),
    sa.Column('first_name', sa.String(length=44), nullable=False),
    sa.Column('last_name', sa.String(length=44), nullable=False),
    sa.Column('product_id', sa.Integer(), nullable=True),
    sa.Column('position_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['position_id'], ['positions.id'], ),
    sa.ForeignKeyConstraint(['product_id'], ['products.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('email'),
    sa.UniqueConstraint('first_name'),
    sa.UniqueConstraint('last_name'),
    sa.UniqueConstraint('username')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('employers')
    op.drop_index(op.f('ix_products_product_name'), table_name='products')
    op.drop_table('products')
    op.drop_table('positions')
    # ### end Alembic commands ###