"""Edit driver assignment

Revision ID: f272ebbba83d
Revises: 47f450cb5e82
Create Date: 2023-09-04 15:36:52.916595

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision: str = 'f272ebbba83d'
down_revision: Union[str, None] = '47f450cb5e82'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('ix_vehicles_Id', table_name='vehicles')
    op.drop_table('vehicles')
    op.drop_index('ix_users_Id', table_name='users')
    op.drop_table('users')
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('users',
    sa.Column('Id', sa.INTEGER(), server_default=sa.text('nextval(\'"users_Id_seq"\'::regclass)'), autoincrement=True, nullable=False),
    sa.Column('Name', sa.VARCHAR(), autoincrement=False, nullable=False),
    sa.Column('MiddleName', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('LastName', sa.VARCHAR(), autoincrement=False, nullable=False),
    sa.Column('BirthDate', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
    sa.Column('ContactNumber', sa.VARCHAR(), autoincrement=False, nullable=False),
    sa.Column('Email', sa.VARCHAR(), autoincrement=False, nullable=False),
    sa.Column('Role', sa.VARCHAR(), autoincrement=False, nullable=False),
    sa.Column('DrivingLicenseNumber', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('HashedPassword', sa.VARCHAR(), autoincrement=False, nullable=False),
    sa.PrimaryKeyConstraint('Id', name='users_pkey')
    )
    op.create_index('ix_users_Id', 'users', ['Id'], unique=False)
    op.create_table('vehicles',
    sa.Column('Id', sa.INTEGER(), server_default=sa.text('nextval(\'"vehicles_Id_seq"\'::regclass)'), autoincrement=True, nullable=False),
    sa.Column('Model', sa.VARCHAR(), autoincrement=False, nullable=False),
    sa.Column('Year', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('LicensePlate', sa.VARCHAR(), autoincrement=False, nullable=False),
    sa.Column('AssignedDriverIds', postgresql.ARRAY(sa.INTEGER()), autoincrement=False, nullable=True),
    sa.Column('CurrentLocation', postgresql.ARRAY(sa.VARCHAR()), autoincrement=False, nullable=True),
    sa.Column('Fuel', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('Mileage', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('Status', sa.VARCHAR(), autoincrement=False, nullable=False),
    sa.Column('Capacity', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('MaintenanceNotes', postgresql.ARRAY(sa.VARCHAR()), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('Id', name='vehicles_pkey')
    )
    op.create_index('ix_vehicles_Id', 'vehicles', ['Id'], unique=False)
    # ### end Alembic commands ###