"""initial migration

Revision ID: 7c864726fb31
Revises: 
Create Date: 2021-04-18 20:51:07.105176

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '7c864726fb31'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('deployments',
    sa.Column('task_id', sa.String(), nullable=False),
    sa.Column('vehicle_id', sa.String(), nullable=True),
    sa.Column('time_task_created', sa.DateTime(timezone=True), nullable=True),
    sa.Column('time_task_resolved', sa.DateTime(timezone=True), nullable=True),
    sa.PrimaryKeyConstraint('task_id')
    )
    op.create_table('pickups',
    sa.Column('task_id', sa.String(), nullable=False),
    sa.Column('vehicle_id', sa.String(), nullable=True),
    sa.Column('qr_code', sa.String(), nullable=True),
    sa.Column('time_task_created', sa.DateTime(timezone=True), nullable=True),
    sa.Column('time_task_resolved', sa.DateTime(timezone=True), nullable=True),
    sa.PrimaryKeyConstraint('task_id')
    )
    op.create_table('rides',
    sa.Column('ride_id', sa.String(), nullable=False),
    sa.Column('vehicle_id', sa.String(), nullable=True),
    sa.Column('time_ride_start', sa.DateTime(timezone=True), nullable=True),
    sa.Column('time_ride_end', sa.DateTime(timezone=True), nullable=True),
    sa.Column('start_lat', sa.Float(), nullable=True),
    sa.Column('start_lng', sa.Float(), nullable=True),
    sa.Column('end_lat', sa.Float(), nullable=True),
    sa.Column('end_lng', sa.Float(), nullable=True),
    sa.Column('distance', sa.Float(), nullable=True),
    sa.Column('gross_amount', sa.Float(), nullable=True),
    sa.PrimaryKeyConstraint('ride_id')
    )
    op.create_table('deployment_cycles',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('deployment_task_id', sa.String(), nullable=True),
    sa.Column('pickup_task_id', sa.String(), nullable=True),
    sa.Column('vehicle_id', sa.String(), nullable=True),
    sa.Column('qr_code', sa.String(), nullable=True),
    sa.Column('time_deployment', sa.DateTime(timezone=True), nullable=True),
    sa.Column('time_pickup', sa.DateTime(timezone=True), nullable=True),
    sa.ForeignKeyConstraint(['deployment_task_id'], ['deployments.task_id'], ),
    sa.ForeignKeyConstraint(['pickup_task_id'], ['pickups.task_id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('deployment_cycles')
    op.drop_table('rides')
    op.drop_table('pickups')
    op.drop_table('deployments')
    # ### end Alembic commands ###
