"""Add order navigation children alphabetically.

Revision ID: 0d279cc03c6e
Revises: da44c279ce0a
Create Date: 2018-05-08 10:02:51.009181

"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship

# revision identifiers, used by Alembic.
revision = '0d279cc03c6e'
down_revision = 'da44c279ce0a'

Base = declarative_base()
db = sa
db.Model = Base
db.relationship = relationship


def create_session():
    connection = op.get_bind()
    session_maker = sa.orm.sessionmaker()
    session = session_maker(bind=connection)
    db.session = session


def upgrade():
    create_session()

    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('nagivation_entry',
                  sa.Column('order_children_alphabetically', sa.Boolean(),
                            nullable=False, server_default='0'))
    # ### end Alembic commands ###


def downgrade():
    create_session()

    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('nagivation_entry', 'order_children_alphabetically')
    # ### end Alembic commands ###

# vim: ft=python
