"""Add columns quantity, asset_commission and commission to Orders

Revision ID: 2aa4fb7b5553
Revises: 55199046e99a
Create Date: 2021-04-15 22:07:42.532328

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '2aa4fb7b5553'
down_revision = '55199046e99a'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('orders', sa.Column('binance_trade_id', sa.Integer(), nullable=True))
    op.add_column('orders', sa.Column('commission', sa.Numeric(), nullable=True))
    op.add_column('orders', sa.Column('commission_asset', sa.String(), nullable=True))
    op.alter_column('trades', 'amount',
               existing_type=sa.NUMERIC(),
               nullable=True)
    op.alter_column('trades', 'buy_price',
               existing_type=sa.NUMERIC(),
               nullable=True)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('trades', 'buy_price',
               existing_type=sa.NUMERIC(),
               nullable=False)
    op.alter_column('trades', 'amount',
               existing_type=sa.NUMERIC(),
               nullable=False)
    op.drop_column('orders', 'commission_asset')
    op.drop_column('orders', 'commission')
    op.drop_column('orders', 'binance_trade_id')
    # ### end Alembic commands ###
