"""Add bundle flag to actions table

Revision ID: c939303434c
Revises: 3e688c191de1
Create Date: 2014-04-04 16:27:44.913449

"""

# revision identifiers, used by Alembic.
revision = 'c939303434c'
down_revision = '3e688c191de1'

from alembic import op
import sqlalchemy as sa


INSERTS = """
UPDATE actions set bundle = '1' where name ='Delete';
UPDATE actions set bundle = '1' where name ='Export';
"""
DELETES = """"""


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


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('actions', sa.Column('bundle', sa.Boolean(), server_default='0', nullable=False))
    ### end Alembic commands ###
    iter_statements(INSERTS)


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('actions', 'bundle')
    ### end Alembic commands ###
