"""Add User Language

Revision ID: d4a70083f72e
Revises: 3512efb5496d
Create Date: 2016-07-22 14:04:43.900826

"""

# revision identifiers, used by Alembic.
revision = 'd4a70083f72e'
down_revision = '3512efb5496d'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_index(op.f('ix_languages_name'), 'languages', ['name'], unique=False)
    op.create_index(op.f('ix_translationvariables_name'), 'translationvariables', ['name'], unique=False)
    op.add_column('users', sa.Column('language_id', sa.Integer(), nullable=True))
    op.create_foreign_key(op.f('fk_users_language_id_languages'), 'users', 'languages', ['language_id'], ['id'])
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(op.f('fk_users_language_id_languages'), 'users', type_='foreignkey')
    op.drop_column('users', 'language_id')
    op.drop_index(op.f('ix_translationvariables_name'), table_name='translationvariables')
    op.drop_index(op.f('ix_languages_name'), table_name='languages')
    ### end Alembic commands ###
