"""empty message

Revision ID: e0741bdfde1d
Revises: dc250d726600
Create Date: 2017-05-29 14:22:30.597232

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

# revision identifiers, used by Alembic.
revision = "e0741bdfde1d"
down_revision = "dc250d726600"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint("projects_aoi_id_fkey", "projects", type_="foreignkey")
    op.drop_table("areas_of_interest")
    op.drop_column("projects", "aoi_id")
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "projects",
        sa.Column("aoi_id", sa.INTEGER(), autoincrement=False, nullable=True),
    )
    op.create_table(
        "areas_of_interest",
        sa.Column("id", sa.INTEGER(), nullable=False),
        sa.Column(
            "geometry",
            geoalchemy2.types.Geometry(geometry_type="MULTIPOLYGON", srid=4326),
            autoincrement=False,
            nullable=True,
        ),
        sa.Column(
            "centroid",
            geoalchemy2.types.Geometry(geometry_type="POINT", srid=4326),
            autoincrement=False,
            nullable=True,
        ),
        sa.PrimaryKeyConstraint("id", name="areas_of_interest_pkey"),
    )
    op.create_foreign_key(
        "projects_aoi_id_fkey", "projects", "areas_of_interest", ["aoi_id"], ["id"]
    )
    # ### end Alembic commands ###
