<reponame>mihalw28/fitness_app
"""all tables

Revision ID: b59c3567d2a5
Revises: 
Create Date: 2019-07-11 13:34:21.862021

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('email', sa.String(length=120), nullable=True),
    sa.Column('password_hash', sa.String(length=128), nullable=True),
    sa.Column('cell_number', sa.String(length=9), nullable=True),
    sa.Column('club_site_login', sa.String(length=64), nullable=True),
    sa.Column('club_site_password', sa.String(length=512), nullable=True),
    sa.Column('club_name', sa.String(length=64), nullable=True),
    sa.Column('club_no', sa.Integer(), nullable=True),
    sa.Column('classes', sa.String(length=50), nullable=True),
    sa.Column('last_seen', sa.DateTime(), nullable=True),
    sa.Column('token', sa.String(length=32), nullable=True),
    sa.Column('token_expiration', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('cell_number')
    )
    op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
    op.create_index(op.f('ix_user_token'), 'user', ['token'], unique=True)
    op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True)
    op.create_table('train',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('your_training', sa.String(length=50), nullable=True),
    sa.Column('training_datetime', sa.DateTime(), nullable=True),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('acceptance', sa.String(length=20), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_train_timestamp'), 'train', ['timestamp'], unique=False)
    op.create_index(op.f('ix_train_training_datetime'), 'train', ['training_datetime'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_train_training_datetime'), table_name='train')
    op.drop_index(op.f('ix_train_timestamp'), table_name='train')
    op.drop_table('train')
    op.drop_index(op.f('ix_user_username'), table_name='user')
    op.drop_index(op.f('ix_user_token'), table_name='user')
    op.drop_index(op.f('ix_user_email'), table_name='user')
    op.drop_table('user')
    # ### end Alembic commands ###

"""all tables

Revision ID: b59c3567d2a5
Revises: 
Create Date: 2019-07-11 13:34:21.862021

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('email', sa.String(length=120), nullable=True),
    sa.Column('password_hash', sa.String(length=128), nullable=True),
    sa.Column('cell_number', sa.String(length=9), nullable=True),
    sa.Column('club_site_login', sa.String(length=64), nullable=True),
    sa.Column('club_site_password', sa.String(length=512), nullable=True),
    sa.Column('club_name', sa.String(length=64), nullable=True),
    sa.Column('club_no', sa.Integer(), nullable=True),
    sa.Column('classes', sa.String(length=50), nullable=True),
    sa.Column('last_seen', sa.DateTime(), nullable=True),
    sa.Column('token', sa.String(length=32), nullable=True),
    sa.Column('token_expiration', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('cell_number')
    )
    op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
    op.create_index(op.f('ix_user_token'), 'user', ['token'], unique=True)
    op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True)
    op.create_table('train',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('your_training', sa.String(length=50), nullable=True),
    sa.Column('training_datetime', sa.DateTime(), nullable=True),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('acceptance', sa.String(length=20), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_train_timestamp'), 'train', ['timestamp'], unique=False)
    op.create_index(op.f('ix_train_training_datetime'), 'train', ['training_datetime'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_train_training_datetime'), table_name='train')
    op.drop_index(op.f('ix_train_timestamp'), table_name='train')
    op.drop_table('train')
    op.drop_index(op.f('ix_user_username'), table_name='user')
    op.drop_index(op.f('ix_user_token'), table_name='user')
    op.drop_index(op.f('ix_user_email'), table_name='user')
    op.drop_table('user')
    # ### end Alembic commands ###
all tables  Revision ID: b59c3567d2a5 Revises:  Create Date: 2019-07-11 13:34:21.862021 # 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 ###