"""Add precision column in SymbolMetadata

Revision ID: e96c68ba9fa5
Revises: fa393fe1acbd
Create Date: 2021-04-18 14:19:04.274018

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('symbol_metadata', sa.Column('quote_precision', sa.Integer(), nullable=True))
    op.execute("UPDATE symbol_metadata SET quote_precision = 0")
    op.alter_column('symbol_metadata', 'quote_precision', nullable=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('symbol_metadata', 'quote_precision')
    # ### end Alembic commands ###
