"""Dateformat

Revision ID: 381ef6581a03
Revises: 1a668c8e3285
Create Date: 2019-06-28 13:06:42.652641

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "381ef6581a03"
down_revision = "1a668c8e3285"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "poll",
        sa.Column(
            "european_date_format", sa.Boolean(), server_default="false", nullable=False
        ),
    )
    op.alter_column(
        "poll",
        "allow_new_options",
        existing_type=sa.BOOLEAN(),
        server_default=None,
        existing_nullable=False,
    )
    op.alter_column(
        "poll",
        "deleted",
        existing_type=sa.BOOLEAN(),
        server_default=None,
        existing_nullable=False,
    )
    op.alter_column(
        "poll",
        "show_percentage",
        existing_type=sa.BOOLEAN(),
        server_default=None,
        existing_nullable=False,
    )
    op.add_column(
        "poll_option",
        sa.Column("is_date", sa.Boolean(), server_default="False", nullable=False),
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column("poll_option", "is_date")
    op.alter_column(
        "poll",
        "show_percentage",
        existing_type=sa.BOOLEAN(),
        server_default=sa.text("true"),
        existing_nullable=False,
    )
    op.alter_column(
        "poll",
        "deleted",
        existing_type=sa.BOOLEAN(),
        server_default=sa.text("false"),
        existing_nullable=False,
    )
    op.alter_column(
        "poll",
        "allow_new_options",
        existing_type=sa.BOOLEAN(),
        server_default=sa.text("false"),
        existing_nullable=False,
    )
    op.drop_column("poll", "european_date_format")
    # ### end Alembic commands ###
