<gh_stars>0
"""Add users and keys schemas

Revision ID: 4f2c1655021a
Revises: 
Create Date: 2018-04-09 05:16:49.149654

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '4f2c1655021a'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user',
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('user_name', sa.String(length=16), nullable=True),
    sa.Column('email', sa.String(length=120), nullable=True),
    sa.Column('password', sa.String(length=128), nullable=True),
    sa.Column('date_created', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('user_id')
    )
    op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
    op.create_index(op.f('ix_user_user_name'), 'user', ['user_name'], unique=True)
    op.create_table('key',
    sa.Column('key_id', sa.Integer(), nullable=False),
    sa.Column('key_name', sa.String(length=32), nullable=True),
    sa.Column('key_value', sa.String(length=32), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('date_created', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['user.user_id'], ),
    sa.PrimaryKeyConstraint('key_id')
    )
    op.create_index(op.f('ix_key_date_created'), 'key', ['date_created'], unique=False)
    op.create_index(op.f('ix_key_key_name'), 'key', ['key_name'], unique=False)
    op.create_index(op.f('ix_key_key_value'), 'key', ['key_value'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_key_key_value'), table_name='key')
    op.drop_index(op.f('ix_key_key_name'), table_name='key')
    op.drop_index(op.f('ix_key_date_created'), table_name='key')
    op.drop_table('key')
    op.drop_index(op.f('ix_user_user_name'), table_name='user')
    op.drop_index(op.f('ix_user_email'), table_name='user')
    op.drop_table('user')
    # ### end Alembic commands ###

"""Add users and keys schemas

Revision ID: 4f2c1655021a
Revises: 
Create Date: 2018-04-09 05:16:49.149654

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '4f2c1655021a'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user',
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('user_name', sa.String(length=16), nullable=True),
    sa.Column('email', sa.String(length=120), nullable=True),
    sa.Column('password', sa.String(length=128), nullable=True),
    sa.Column('date_created', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('user_id')
    )
    op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
    op.create_index(op.f('ix_user_user_name'), 'user', ['user_name'], unique=True)
    op.create_table('key',
    sa.Column('key_id', sa.Integer(), nullable=False),
    sa.Column('key_name', sa.String(length=32), nullable=True),
    sa.Column('key_value', sa.String(length=32), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('date_created', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['user.user_id'], ),
    sa.PrimaryKeyConstraint('key_id')
    )
    op.create_index(op.f('ix_key_date_created'), 'key', ['date_created'], unique=False)
    op.create_index(op.f('ix_key_key_name'), 'key', ['key_name'], unique=False)
    op.create_index(op.f('ix_key_key_value'), 'key', ['key_value'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_key_key_value'), table_name='key')
    op.drop_index(op.f('ix_key_key_name'), table_name='key')
    op.drop_index(op.f('ix_key_date_created'), table_name='key')
    op.drop_table('key')
    op.drop_index(op.f('ix_user_user_name'), table_name='user')
    op.drop_index(op.f('ix_user_email'), table_name='user')
    op.drop_table('user')
    # ### end Alembic commands ###
Add users and keys schemas  Revision ID: 4f2c1655021a Revises:  Create Date: 2018-04-09 05:16:49.149654 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###