"""Add id to playlist association table

Revision ID: 9bf80ba3635f
Revises: f071129cbd93
Create Date: 2021-03-28 12:16:14.631579

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '9bf80ba3635f'
down_revision = 'f071129cbd93'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    conn = op.get_bind()
    conn.execute(
        "ALTER TABLE playlistracks ADD id INT PRIMARY KEY AUTO_INCREMENT FIRST"
    )
    conn.execute("RENAME TABLE playlistracks TO playlisttracks")
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    conn = op.get_bind()
    conn.execute("ALTER TABLE playlistracks DROP id")
    conn.execute("RENAME TABLE playlisttracks TO playlistracks")
    # ### end Alembic commands ###
