"""empty message

Revision ID: 699c4f6a7fe8
Revises: b1c05324cc13
Create Date: 2020-07-28 16:29:41.403957

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

from project import dbtypes

# revision identifiers, used by Alembic.
revision = "699c4f6a7fe8"
down_revision = "b1c05324cc13"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "eventorganizer", sa.Column("admin_unit_id", sa.Integer(), nullable=True)
    )
    op.create_foreign_key(
        None, "eventorganizer", "adminunit", ["admin_unit_id"], ["id"]
    )
    op.add_column("eventplace", sa.Column("admin_unit_id", sa.Integer(), nullable=True))
    op.add_column("eventplace", sa.Column("organizer_id", sa.Integer(), nullable=True))
    op.add_column("eventplace", sa.Column("public", sa.Boolean(), nullable=True))
    op.create_foreign_key(
        None, "eventplace", "eventorganizer", ["organizer_id"], ["id"]
    )
    op.create_foreign_key(None, "eventplace", "adminunit", ["admin_unit_id"], ["id"])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, "eventplace", type_="foreignkey")
    op.drop_constraint(None, "eventplace", type_="foreignkey")
    op.drop_column("eventplace", "public")
    op.drop_column("eventplace", "organizer_id")
    op.drop_column("eventplace", "admin_unit_id")
    op.drop_constraint(None, "eventorganizer", type_="foreignkey")
    op.drop_column("eventorganizer", "admin_unit_id")
    # ### end Alembic commands ###
