"""initial

Revision ID: d5a0ab2f898d
Revises: 
Create Date: 2020-05-30 00:16:04.225937

"""
from alembic import op
import sqlalchemy as sa
import trading_data_provider

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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('provider',
    sa.Column('id', trading_data_provider.models.type.GUID(), nullable=False),
    sa.Column('name', sa.String(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('candles',
    sa.Column('date', sa.DateTime(timezone=True), nullable=False),
    sa.Column('open', sa.Float(precision=53), nullable=True),
    sa.Column('close', sa.Float(precision=53), nullable=True),
    sa.Column('high', sa.Float(precision=53), nullable=True),
    sa.Column('low', sa.Float(precision=53), nullable=True),
    sa.Column('average', sa.Float(precision=53), nullable=True),
    sa.Column('volume', sa.Float(precision=53), nullable=True),
    sa.Column('provider_id', trading_data_provider.models.type.GUID(), nullable=False),
    sa.ForeignKeyConstraint(['provider_id'], ['provider.id'], ),
    sa.PrimaryKeyConstraint('date', 'provider_id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('candles')
    op.drop_table('provider')
    # ### end Alembic commands ###
