"""empty message

Revision ID: 07fef677d603
Revises: f50003753b9f
Create Date: 2019-06-06 15:52:16.243415

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
import geoalchemy2

# revision identifiers, used by Alembic.
revision = '07fef677d603'
down_revision = 'f50003753b9f'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('prediction_tiles',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('prediction_id', sa.BigInteger(), nullable=False),
    sa.Column('quadkey', sa.String(), nullable=False),
    sa.Column('centroid', geoalchemy2.types.Geometry(geometry_type='POINT', srid=4326), nullable=True),
    sa.Column('predictions', postgresql.JSONB(astext_type=sa.Text()), nullable=False),
    sa.ForeignKeyConstraint(['prediction_id'], ['predictions.id'], name='fk_predictions'),
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_column('predictions', 'predictions')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('predictions', sa.Column('predictions', postgresql.JSONB(astext_type=sa.Text()), autoincrement=False, nullable=False))
    op.drop_table('prediction_tiles')
    # ### end Alembic commands ###
