"""empty message

Revision ID: f2a97489889f
Revises: 8a7e716a562c
Create Date: 2018-11-10 10:07:22.785103

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "f2a97489889f"
down_revision = "8a7e716a562c"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "movie_preferences",
        sa.Column("external_movie_id", sa.String(length=20), nullable=False),
    )
    op.drop_constraint(
        "movie_preferences_user_id_omdb_movie_id_key",
        "movie_preferences",
        type_="unique",
    )
    op.drop_column("movie_preferences", "omdb_movie_id")
    op.alter_column(
        "users", "password_hash", existing_type=sa.VARCHAR(length=64), nullable=False
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(
        "users", "password_hash", existing_type=sa.VARCHAR(length=64), nullable=True
    )
    op.add_column(
        "movie_preferences",
        sa.Column(
            "omdb_movie_id", sa.VARCHAR(length=20), autoincrement=False, nullable=False
        ),
    )
    op.create_unique_constraint(
        "movie_preferences_user_id_omdb_movie_id_key",
        "movie_preferences",
        ["user_id", "omdb_movie_id"],
    )
    op.drop_column("movie_preferences", "external_movie_id")
    # ### end Alembic commands ###
