"""Add market prices

Revision ID: 552a52533dac
Revises: 13068944e7b1
Create Date: 2016-07-27 21:35:27.506811

"""

# revision identifiers, used by Alembic.
revision = '552a52533dac'
down_revision = '13068944e7b1'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('historical_prices',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('market_id', sa.Integer(), nullable=True),
    sa.Column('time', sa.DateTime(), nullable=True),
    sa.Column('lambdaD', sa.Float(), nullable=True),
    sa.Column('MAvsMD', sa.Float(), nullable=True),
    sa.Column('r_pos', sa.Float(), nullable=True),
    sa.Column('r_neg', sa.Float(), nullable=True),
    sa.Column('sqrt_r', sa.Float(), nullable=True),
    sa.ForeignKeyConstraint(['market_id'], ['markets.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_historical_prices_market_id'), 'historical_prices', ['market_id'], unique=False)
    op.create_index(op.f('ix_historical_prices_time'), 'historical_prices', ['time'], unique=False)
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_historical_prices_time'), table_name='historical_prices')
    op.drop_index(op.f('ix_historical_prices_market_id'), table_name='historical_prices')
    op.drop_table('historical_prices')
    ### end Alembic commands ###
