"""Add client and server tables for managing API connections.

Revision ID: 0df7f3dc4d23
Revises: d041922684eb
Create Date: 2018-01-31 14:35:26.640344

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '0df7f3dc4d23'
down_revision = 'd041922684eb'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('client',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('timestamp', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=255), nullable=False),
    sa.Column('token', sa.String(length=36), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    mysql_charset='utf8mb4'
    )
    op.create_index(op.f('ix_client_timestamp'), 'client', ['timestamp'], unique=False)
    op.create_table('server',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('timestamp', sa.Integer(), nullable=False),
    sa.Column('uri', sa.String(length=1024), nullable=False),
    sa.Column('token', sa.String(length=36), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    mysql_charset='utf8mb4'
    )
    op.create_index(op.f('ix_server_timestamp'), 'server', ['timestamp'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_server_timestamp'), table_name='server')
    op.drop_table('server')
    op.drop_index(op.f('ix_client_timestamp'), table_name='client')
    op.drop_table('client')
    # ### end Alembic commands ###
