"""Upgrade to new ringo version

Revision ID: b361b7c1609a
Revises: c30fe604dac7
Create Date: 2017-06-23 13:51:58.846408

"""

# revision identifiers, used by Alembic.
revision = 'b361b7c1609a'
down_revision = 'c30fe604dac7'

from alembic import op
import sqlalchemy as sa


INSERTS = """"""
DELETES = """"""


def iter_statements(stmts):
    for st in [x for x in stmts.split('\n') if x]:
        op.execute(st)


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('actions', sa.Column('admin', sa.Boolean(), server_default='0', nullable=False))
    op.create_unique_constraint(None, 'nm_action_roles', ['aid', 'rid'])
    op.create_unique_constraint(None, 'nm_user_roles', ['uid', 'rid'])
    op.create_unique_constraint(None, 'nm_user_usergroups', ['uid', 'gid'])
    ### end Alembic commands ###
    iter_statements(INSERTS)


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'nm_user_usergroups', type_='unique')
    op.drop_constraint(None, 'nm_user_roles', type_='unique')
    op.drop_constraint(None, 'nm_action_roles', type_='unique')
    op.drop_column('actions', 'admin')
    ### end Alembic commands ###
    iter_statements(DELETES)
