"""empty message

Revision ID: 51239a6a31d9
Revises: dd6f43a2bd2d
Create Date: 2020-01-16 20:09:51.499028

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "51239a6a31d9"
down_revision = "dd6f43a2bd2d"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "products",
        sa.Column(
            "platforms",
            sa.ARRAY(sa.Enum("MAPS", "METRO", "NAVI", name="platformtype")),
            nullable=True,
        ),
    )
    op.execute(
        """
        UPDATE products
        SET platforms = ARRAY[platform]
    """
    )
    op.alter_column("products", "platforms", nullable=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column("products", "platforms")
    # ### end Alembic commands ###
