"""Add 'played' column to playlist_rows

Revision ID: 0c604bf490f8
Revises: 29c0d7ffc741
Create Date: 2022-08-12 14:12:38.419845

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = '0c604bf490f8'
down_revision = '29c0d7ffc741'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('playlist_rows', sa.Column('played', sa.Boolean(), nullable=False))
    op.drop_index('ix_tracks_lastplayed', table_name='tracks')
    op.drop_column('tracks', 'lastplayed')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('tracks', sa.Column('lastplayed', mysql.DATETIME(), nullable=True))
    op.create_index('ix_tracks_lastplayed', 'tracks', ['lastplayed'], unique=False)
    op.drop_column('playlist_rows', 'played')
    # ### end Alembic commands ###
