"""seed channels table

Revision ID: 5a935c07953e
Revises: ad617e352b38
Create Date: 2019-06-11 13:08:24.223415

"""
from alembic import op
import sqlalchemy as sa
from api.database import channels_table


# revision identifiers, used by Alembic.
revision = '5a935c07953e'
down_revision = 'ad617e352b38'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.bulk_insert(channels_table, [
        {
            'id': 1,
            'name': 'red',
            'url': 'https://cdn.voscast.com/stats/display.js?key=40dce4ae142ed966aa6bdd8048c989d2&stats=songtitle&action=update'
        },
        {
            'id': 2,
            'name': 'green',
            'url': 'https://cdn.voscast.com/stats/display.js?key=843b6fa06db8c1e17d538547afe14635&stats=songtitle&action=update'
        },
        {
            'id': 3,
            'name': 'blue',
            'url': 'https://cdn.voscast.com/stats/display.js?key=82f6aa25633d7d23d8370c68e1210a9c&stats=songtitle&action=update'
        },
    ])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    bind = op.get_bind()
    for row in bind.execute(channels_table.select()):
        op.execute(channels_table.delete().where(channels_table.c.id == row.id))
    # ### end Alembic commands ###
