"""added object order

Peek Plugin Database Migration Script

Revision ID: 5e2b9afbb499
Revises: 36aeb6eaea5c
Create Date: 2019-08-06 10:19:09.787190

"""

# revision identifiers, used by Alembic.
revision = '5e2b9afbb499'
down_revision = '36aeb6eaea5c'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa
import geoalchemy2


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('SearchObjectType', sa.Column('order', sa.Integer(), server_default='0', nullable=False), schema='core_search')


    op.execute(''' UPDATE "core_search"."SearchObjectType" SET "order" = 0 ''')

    op.alter_column('SearchObjectType', 'order',
                    type_=sa.Integer(), nullable=False,
                    schema='core_search')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('SearchObjectType', 'order', schema='core_search')
    # ### end Alembic commands ###