"""Added more fields for strava streams

Revision ID: 166609d1dce1
Revises: d05d9ced3e65
Create Date: 2016-11-10 21:50:15.364323

"""

# revision identifiers, used by Alembic.
revision = '166609d1dce1'
down_revision = 'd05d9ced3e65'

from alembic import op
import sqlalchemy as sa
import trainable


INSERTS = """"""
DELETES = """"""


def iter_statements(stmts):
    for st in [x for x in stmts.split('\n') if x]:
        op.execute(st)


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('activitys', sa.Column('altitude_stream', trainable.model.activity.Json(), nullable=True))
    op.add_column('activitys', sa.Column('cadence_stream', trainable.model.activity.Json(), nullable=True))
    op.add_column('activitys', sa.Column('distance_stream', trainable.model.activity.Json(), nullable=True))
    op.add_column('activitys', sa.Column('grade_smooth_stream', trainable.model.activity.Json(), nullable=True))
    op.add_column('activitys', sa.Column('latlng_stream', trainable.model.activity.Json(), nullable=True))
    op.add_column('activitys', sa.Column('moving_stream', trainable.model.activity.Json(), nullable=True))
    op.add_column('activitys', sa.Column('temp_stream', trainable.model.activity.Json(), nullable=True))
    op.add_column('activitys', sa.Column('time_stream', trainable.model.activity.Json(), nullable=True))
    op.add_column('activitys', sa.Column('velocity_smooth_stream', trainable.model.activity.Json(), nullable=True))
    op.add_column('activitys', sa.Column('watts_stream', trainable.model.activity.Json(), nullable=True))
    ### end Alembic commands ###
    iter_statements(INSERTS)


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('activitys', 'watts_stream')
    op.drop_column('activitys', 'velocity_smooth_stream')
    op.drop_column('activitys', 'time_stream')
    op.drop_column('activitys', 'temp_stream')
    op.drop_column('activitys', 'moving_stream')
    op.drop_column('activitys', 'latlng_stream')
    op.drop_column('activitys', 'grade_smooth_stream')
    op.drop_column('activitys', 'distance_stream')
    op.drop_column('activitys', 'cadence_stream')
    op.drop_column('activitys', 'altitude_stream')
    ### end Alembic commands ###
    iter_statements(DELETES)
