"""adding role to users

Revision ID: 3<PASSWORD>
Revises: <PASSWORD>
Create Date: 2015-04-08 18:10:20.866273

"""

# revision identifiers, used by Alembic.
revision = '3<PASSWORD>'
down_revision = '<PASSWORD>'

from alembic import op
import sqlalchemy as sa


def upgrade():
    op.add_column('users', sa.Column('role', sa.String(), nullable=False))

    op.create_check_constraint(
        "ck_users_role",
        "users",
        "role in ('supplier', 'admin', 'buyer')"
    )


def downgrade():
    op.drop_column('users', 'role')
