"""Added in_use column to Variables.

Revision ID: 6da215bb5f1
Revises: 23dcdff2dad2
Create Date: 2013-05-27 15:33:18.800755

"""

# revision identifiers, used by Alembic.
revision = '6da215bb5f1'
down_revision = '23dcdff2dad2'

from alembic import op
import sqlalchemy as sa


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('role', u'description',
               existing_type=sa.VARCHAR(length=255),
               nullable=False)
    op.alter_column('role', u'name',
               existing_type=sa.VARCHAR(length=80),
               nullable=False)
    op.alter_column('user', u'username',
               existing_type=sa.VARCHAR(length=80),
               nullable=False)
    op.alter_column('user', u'email',
               existing_type=sa.VARCHAR(length=255),
               nullable=False)
    op.alter_column('user', u'password',
               existing_type=sa.VARCHAR(length=255),
               nullable=False)
    op.add_column('variable', sa.Column('in_use', sa.Boolean(), nullable=False,
                 server_default='1'))
    op.alter_column('variable', u'description',
               existing_type=sa.VARCHAR(length=300),
               nullable=False)
    op.alter_column('variable', u'dimension_id',
               existing_type=sa.INTEGER(),
               nullable=False)
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('variable', u'dimension_id',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.alter_column('variable', u'description',
               existing_type=sa.VARCHAR(length=300),
               nullable=True)
    op.drop_column('variable', 'in_use')
    op.alter_column('user', u'password',
               existing_type=sa.VARCHAR(length=255),
               nullable=True)
    op.alter_column('user', u'email',
               existing_type=sa.VARCHAR(length=255),
               nullable=True)
    op.alter_column('user', u'username',
               existing_type=sa.VARCHAR(length=80),
               nullable=True)
    op.alter_column('role', u'name',
               existing_type=sa.VARCHAR(length=80),
               nullable=True)
    op.alter_column('role', u'description',
               existing_type=sa.VARCHAR(length=255),
               nullable=True)
    ### end Alembic commands ###
