"""empty message

Revision ID: bc79206537e7
Revises: 10bd52b06872
Create Date: 2021-10-16 23:55:25.599527

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('car',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('car_class', sa.String(length=4), nullable=True),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('drivetrain', sa.String(length=64), nullable=True),
    sa.Column('image', sa.String(length=256), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('owned_car',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('car_id', sa.Integer(), nullable=True),
    sa.Column('engine_level', sa.Integer(), nullable=True),
    sa.Column('transmission_level', sa.Integer(), nullable=True),
    sa.Column('turbo_level', sa.Integer(), nullable=True),
    sa.Column('brakes_level', sa.Integer(), nullable=True),
    sa.Column('suspension_level', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['car_id'], ['car.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('track',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('lap_race', sa.Boolean(), nullable=True),
    sa.Column('record_time', sa.Integer(), nullable=True),
    sa.Column('record_holder', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['record_holder'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('mining_entry',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('job', sa.Integer(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('no_pay', sa.Boolean(), nullable=True),
    sa.Column('sell_value', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['job'], ['job.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_mining_entry_timestamp'), 'mining_entry', ['timestamp'], unique=False)
    op.create_table('race',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('start_time', sa.DateTime(), nullable=True),
    sa.Column('laps', sa.Integer(), nullable=True),
    sa.Column('track', sa.Integer(), nullable=True),
    sa.Column('crew_race', sa.Boolean(), nullable=True),
    sa.Column('highest_class', sa.String(length=4), nullable=True),
    sa.ForeignKeyConstraint(['track'], ['track.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_race_start_time'), 'race', ['start_time'], unique=False)
    op.create_index(op.f('ix_race_timestamp'), 'race', ['timestamp'], unique=False)
    op.create_table('race_performance',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('car_id', sa.Integer(), nullable=True),
    sa.Column('car_details', sa.Integer(), nullable=True),
    sa.Column('track_id', sa.Integer(), nullable=True),
    sa.Column('race_id', sa.Integer(), nullable=True),
    sa.Column('start_position', sa.Integer(), nullable=True),
    sa.Column('end_position', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['car_details'], ['owned_car.id'], ),
    sa.ForeignKeyConstraint(['car_id'], ['car.id'], ),
    sa.ForeignKeyConstraint(['race_id'], ['race.id'], ),
    sa.ForeignKeyConstraint(['track_id'], ['track.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column('order', sa.Column('user_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'order', 'user', ['user_id'], ['id'])
    op.add_column('user', sa.Column('racer_updated', sa.DateTime(), nullable=True))
    op.add_column('user', sa.Column('race_lead', sa.Boolean(), nullable=True))
    op.add_column('user', sa.Column('racer', sa.Boolean(), nullable=True))
    op.add_column('user', sa.Column('race_crew', sa.String(length=120), nullable=True))
    op.add_column('user', sa.Column('race_points', sa.Integer(), nullable=True))
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('user', 'race_points')
    op.drop_column('user', 'race_crew')
    op.drop_column('user', 'racer')
    op.drop_column('user', 'race_lead')
    op.drop_column('user', 'racer_updated')
    op.drop_constraint(None, 'order', type_='foreignkey')
    op.drop_column('order', 'user_id')
    op.drop_table('race_performance')
    op.drop_index(op.f('ix_race_timestamp'), table_name='race')
    op.drop_index(op.f('ix_race_start_time'), table_name='race')
    op.drop_table('race')
    op.drop_index(op.f('ix_mining_entry_timestamp'), table_name='mining_entry')
    op.drop_table('mining_entry')
    op.drop_table('track')
    op.drop_table('owned_car')
    op.drop_table('car')
    # ### end Alembic commands ###

"""empty message

Revision ID: bc79206537e7
Revises: 10bd52b06872
Create Date: 2021-10-16 23:55:25.599527

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('car',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('car_class', sa.String(length=4), nullable=True),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('drivetrain', sa.String(length=64), nullable=True),
    sa.Column('image', sa.String(length=256), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('owned_car',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('car_id', sa.Integer(), nullable=True),
    sa.Column('engine_level', sa.Integer(), nullable=True),
    sa.Column('transmission_level', sa.Integer(), nullable=True),
    sa.Column('turbo_level', sa.Integer(), nullable=True),
    sa.Column('brakes_level', sa.Integer(), nullable=True),
    sa.Column('suspension_level', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['car_id'], ['car.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('track',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('lap_race', sa.Boolean(), nullable=True),
    sa.Column('record_time', sa.Integer(), nullable=True),
    sa.Column('record_holder', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['record_holder'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('mining_entry',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('job', sa.Integer(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('no_pay', sa.Boolean(), nullable=True),
    sa.Column('sell_value', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['job'], ['job.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_mining_entry_timestamp'), 'mining_entry', ['timestamp'], unique=False)
    op.create_table('race',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.Column('start_time', sa.DateTime(), nullable=True),
    sa.Column('laps', sa.Integer(), nullable=True),
    sa.Column('track', sa.Integer(), nullable=True),
    sa.Column('crew_race', sa.Boolean(), nullable=True),
    sa.Column('highest_class', sa.String(length=4), nullable=True),
    sa.ForeignKeyConstraint(['track'], ['track.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_race_start_time'), 'race', ['start_time'], unique=False)
    op.create_index(op.f('ix_race_timestamp'), 'race', ['timestamp'], unique=False)
    op.create_table('race_performance',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('car_id', sa.Integer(), nullable=True),
    sa.Column('car_details', sa.Integer(), nullable=True),
    sa.Column('track_id', sa.Integer(), nullable=True),
    sa.Column('race_id', sa.Integer(), nullable=True),
    sa.Column('start_position', sa.Integer(), nullable=True),
    sa.Column('end_position', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['car_details'], ['owned_car.id'], ),
    sa.ForeignKeyConstraint(['car_id'], ['car.id'], ),
    sa.ForeignKeyConstraint(['race_id'], ['race.id'], ),
    sa.ForeignKeyConstraint(['track_id'], ['track.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column('order', sa.Column('user_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'order', 'user', ['user_id'], ['id'])
    op.add_column('user', sa.Column('racer_updated', sa.DateTime(), nullable=True))
    op.add_column('user', sa.Column('race_lead', sa.Boolean(), nullable=True))
    op.add_column('user', sa.Column('racer', sa.Boolean(), nullable=True))
    op.add_column('user', sa.Column('race_crew', sa.String(length=120), nullable=True))
    op.add_column('user', sa.Column('race_points', sa.Integer(), nullable=True))
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('user', 'race_points')
    op.drop_column('user', 'race_crew')
    op.drop_column('user', 'racer')
    op.drop_column('user', 'race_lead')
    op.drop_column('user', 'racer_updated')
    op.drop_constraint(None, 'order', type_='foreignkey')
    op.drop_column('order', 'user_id')
    op.drop_table('race_performance')
    op.drop_index(op.f('ix_race_timestamp'), table_name='race')
    op.drop_index(op.f('ix_race_start_time'), table_name='race')
    op.drop_table('race')
    op.drop_index(op.f('ix_mining_entry_timestamp'), table_name='mining_entry')
    op.drop_table('mining_entry')
    op.drop_table('track')
    op.drop_table('owned_car')
    op.drop_table('car')
    # ### end Alembic commands ###

empty message  Revision ID: bc79206537e7 Revises: 10bd52b06872 Create Date: 2021-10-16 23:55:25.599527 # 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 ###