"""empty message

Revision ID: b592d959ded3
Revises: fb3286adb02b
Create Date: 2019-08-07 16:50:35.105257

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "b592d959ded3"
down_revision = "fb3286adb02b"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "cars",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("name", sa.String(), nullable=True),
        sa.Column("type", sa.Integer(), nullable=False),
        sa.Column("number", sa.String(), nullable=False),
        sa.Column("teacher_id", sa.Integer(), nullable=False),
        sa.Column("created_at", sa.DateTime(), nullable=False),
        sa.ForeignKeyConstraint(["teacher_id"], ["teachers.id"]),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "kilometers",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("start_of_day", sa.Float(), nullable=False),
        sa.Column("end_of_day", sa.Float(), nullable=False),
        sa.Column("personal", sa.Float(), nullable=False),
        sa.Column("date", sa.DateTime(), nullable=False),
        sa.Column("teacher_id", sa.Integer(), nullable=False),
        sa.Column("car_id", sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(["car_id"], ["cars.id"]),
        sa.ForeignKeyConstraint(["teacher_id"], ["teachers.id"]),
        sa.PrimaryKeyConstraint("id"),
    )
    op.add_column("reports", sa.Column("car_id", sa.Integer(), nullable=True))
    op.create_foreign_key(None, "reports", "cars", ["car_id"], ["id"])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, "reports", type_="foreignkey")
    op.drop_column("reports", "car_id")
    op.drop_table("kilometers")
    op.drop_table("cars")
    # ### end Alembic commands ###
