"""empty message

Revision ID: ff019462f902
Revises: 
Create Date: 2020-09-10 21:13:08.345520

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('securities',
    sa.Column('securityid', sa.Integer(), nullable=False),
    sa.Column('securitytype', sa.String(length=30), nullable=True),
    sa.Column('securityname', sa.String(length=30), nullable=True),
    sa.Column('initialprice', sa.Float(), nullable=True),
    sa.Column('currentprice', sa.Float(), nullable=True),
    sa.PrimaryKeyConstraint('securityid')
    )
    op.alter_column('trades', 'brokername',
               existing_type=sa.VARCHAR(length=10),
               nullable=True)
    op.alter_column('trades', 'price',
               existing_type=sa.REAL(),
               nullable=True)
    op.alter_column('trades', 'quantity',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.alter_column('trades', 'security',
               existing_type=sa.VARCHAR(length=15),
               nullable=True)
    op.alter_column('trades', 'securitytype',
               existing_type=sa.VARCHAR(length=15),
               nullable=True)
    op.alter_column('trades', 'tradeby',
               existing_type=sa.VARCHAR(length=10),
               nullable=True)
    op.alter_column('trades', 'tradedate',
               existing_type=sa.DATE(),
               nullable=True)
    op.alter_column('trades', 'tradetime',
               existing_type=postgresql.TIME(),
               nullable=True)
    op.alter_column('trades', 'tradetype',
               existing_type=sa.VARCHAR(length=5),
               nullable=True)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('trades', 'tradetype',
               existing_type=sa.VARCHAR(length=5),
               nullable=False)
    op.alter_column('trades', 'tradetime',
               existing_type=postgresql.TIME(),
               nullable=False)
    op.alter_column('trades', 'tradedate',
               existing_type=sa.DATE(),
               nullable=False)
    op.alter_column('trades', 'tradeby',
               existing_type=sa.VARCHAR(length=10),
               nullable=False)
    op.alter_column('trades', 'securitytype',
               existing_type=sa.VARCHAR(length=15),
               nullable=False)
    op.alter_column('trades', 'security',
               existing_type=sa.VARCHAR(length=15),
               nullable=False)
    op.alter_column('trades', 'quantity',
               existing_type=sa.INTEGER(),
               nullable=False)
    op.alter_column('trades', 'price',
               existing_type=sa.REAL(),
               nullable=False)
    op.alter_column('trades', 'brokername',
               existing_type=sa.VARCHAR(length=10),
               nullable=False)
    op.drop_table('securities')
    # ### end Alembic commands ###
