"""empty message

Revision ID: ed<PASSWORD>
Revises: 
Create Date: 2020-07-18 19:34:50.950191

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'edf<PASSWORD>'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('disciplines',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=128), nullable=False),
    sa.Column('length', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=16), nullable=True),
    sa.Column('is_route', sa.Boolean(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_disciplines_name'), 'disciplines', ['name'], unique=True)
    op.create_table('token_registry',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('jti', sa.String(length=64), nullable=False),
    sa.Column('token_type', sa.String(length=8), nullable=False),
    sa.Column('username', sa.String(length=16), nullable=False),
    sa.Column('revoked', sa.Boolean(), nullable=False),
    sa.Column('expires', sa.DateTime(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_token_registry_jti'), 'token_registry', ['jti'], unique=False)
    op.create_index(op.f('ix_token_registry_username'), 'token_registry', ['username'], unique=False)
    op.create_table('user_confirmation_codes',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=16), nullable=False),
    sa.Column('code', sa.String(length=64), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_user_confirmation_codes_username'), 'user_confirmation_codes', ['username'], unique=True)
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.Column('username', sa.String(length=16), nullable=False),
    sa.Column('email', sa.String(length=128), nullable=False),
    sa.Column('password', sa.String(length=128), nullable=True),
    sa.Column('confirmed', sa.Boolean(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
    op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
    op.create_table('workout_categories',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=32), nullable=False),
    sa.Column('supports_gps_data', sa.Boolean(), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_index(op.f('ix_workout_categories_id'), 'workout_categories', ['id'], unique=False)
    op.create_table('training_goal_categories',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=32), nullable=False),
    sa.Column('unit', sa.String(length=16), nullable=True),
    sa.Column('workout_category_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['workout_category_id'], ['workout_categories.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name', 'workout_category_id', name='_name_workout_cat_id_uc')
    )
    op.create_index(op.f('ix_training_goal_categories_id'), 'training_goal_categories', ['id'], unique=False)
    op.create_table('user_profiles',
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('height', sa.Integer(), nullable=True),
    sa.Column('weight', sa.Float(), nullable=True),
    sa.Column('birth_date', sa.Date(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_user_profiles_id'), 'user_profiles', ['id'], unique=False)
    op.create_index(op.f('ix_user_profiles_user_id'), 'user_profiles', ['user_id'], unique=True)
    op.create_table('profile_weight_history',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('profile_id', sa.Integer(), nullable=False),
    sa.Column('weight', sa.Float(), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.ForeignKeyConstraint(['profile_id'], ['user_profiles.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_profile_weight_history_id'), 'profile_weight_history', ['id'], unique=False)
    op.create_table('training_goals',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('start_at', sa.DateTime(), nullable=False),
    sa.Column('end_at', sa.DateTime(), nullable=False),
    sa.Column('start_value', sa.Float(), nullable=False),
    sa.Column('current_value', sa.Float(), nullable=False),
    sa.Column('target_value', sa.Float(), nullable=False),
    sa.Column('category_id', sa.Integer(), nullable=False),
    sa.Column('profile_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['category_id'], ['training_goal_categories.id'], ),
    sa.ForeignKeyConstraint(['profile_id'], ['user_profiles.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_training_goals_profile_id'), 'training_goals', ['profile_id'], unique=False)
    op.create_table('workouts',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=128), nullable=False),
    sa.Column('start_at', sa.DateTime(), nullable=False),
    sa.Column('distance', sa.Integer(), nullable=False),
    sa.Column('duration', sa.Integer(), nullable=False),
    sa.Column('climb', sa.Integer(), nullable=False),
    sa.Column('resource_path', sa.String(length=255), nullable=True),
    sa.Column('edited', sa.Boolean(), nullable=False),
    sa.Column('category_id', sa.Integer(), nullable=False),
    sa.Column('profile_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['category_id'], ['workout_categories.id'], ),
    sa.ForeignKeyConstraint(['profile_id'], ['user_profiles.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('resource_path')
    )
    op.create_index(op.f('ix_workouts_profile_id'), 'workouts', ['profile_id'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_workouts_profile_id'), table_name='workouts')
    op.drop_table('workouts')
    op.drop_index(op.f('ix_training_goals_profile_id'), table_name='training_goals')
    op.drop_table('training_goals')
    op.drop_index(op.f('ix_profile_weight_history_id'), table_name='profile_weight_history')
    op.drop_table('profile_weight_history')
    op.drop_index(op.f('ix_user_profiles_user_id'), table_name='user_profiles')
    op.drop_index(op.f('ix_user_profiles_id'), table_name='user_profiles')
    op.drop_table('user_profiles')
    op.drop_index(op.f('ix_training_goal_categories_id'), table_name='training_goal_categories')
    op.drop_table('training_goal_categories')
    op.drop_index(op.f('ix_workout_categories_id'), table_name='workout_categories')
    op.drop_table('workout_categories')
    op.drop_index(op.f('ix_users_username'), table_name='users')
    op.drop_index(op.f('ix_users_email'), table_name='users')
    op.drop_table('users')
    op.drop_index(op.f('ix_user_confirmation_codes_username'), table_name='user_confirmation_codes')
    op.drop_table('user_confirmation_codes')
    op.drop_index(op.f('ix_token_registry_username'), table_name='token_registry')
    op.drop_index(op.f('ix_token_registry_jti'), table_name='token_registry')
    op.drop_table('token_registry')
    op.drop_index(op.f('ix_disciplines_name'), table_name='disciplines')
    op.drop_table('disciplines')
    # ### end Alembic commands ###
