"""empty message

Revision ID: 62e071b0da50
Revises: dcd0b71650b0
Create Date: 2020-07-30 13:13:44.694716

"""
import sqlalchemy as sa
import sqlalchemy_utils
from alembic import op

from project import dbtypes

# revision identifiers, used by Alembic.
revision = "62e071b0da50"
down_revision = "dcd0b71650b0"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(
        "eventorganizer", "name", existing_type=sa.VARCHAR(length=255), nullable=False
    )
    op.create_unique_constraint(None, "eventorganizer", ["name", "admin_unit_id"])
    op.drop_column("eventorganizer", "org_name")
    op.create_unique_constraint(
        None, "eventplace", ["name", "organizer_id", "admin_unit_id"]
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, "eventplace", type_="unique")
    op.add_column(
        "eventorganizer",
        sa.Column(
            "org_name", sa.VARCHAR(length=255), autoincrement=False, nullable=True
        ),
    )
    op.drop_constraint(None, "eventorganizer", type_="unique")
    op.alter_column(
        "eventorganizer", "name", existing_type=sa.VARCHAR(length=255), nullable=True
    )
    # ### end Alembic commands ###
