|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- """create User and Vehicle tables
-
- Revision ID: 9a0214838ac8
- Revises:
- Create Date: 2023-09-01 13:31:01.324861
-
- """
- from typing import Sequence, Union
-
- from alembic import op
- import sqlalchemy as sa
-
-
- # revision identifiers, used by Alembic.
- revision: str = '9a0214838ac8'
- down_revision: Union[str, None] = None
- 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.create_table('users',
- sa.Column('Id', sa.Integer(), nullable=False),
- sa.Column('Name', sa.String(), nullable=False),
- sa.Column('MiddleName', sa.String(), nullable=True),
- sa.Column('LastName', sa.String(), nullable=False),
- sa.Column('BirthDate', sa.DateTime(), nullable=False),
- sa.Column('ContactNumber', sa.String(), nullable=False),
- sa.Column('Email', sa.String(), nullable=False),
- sa.Column('Role', sa.String(), nullable=False),
- sa.Column('DrivingLicenseNumber', sa.String(), nullable=True),
- sa.Column('HashedPassword', sa.String(), nullable=False),
- sa.PrimaryKeyConstraint('Id')
- )
- op.create_index(op.f('ix_users_Id'), 'users', ['Id'], unique=False)
- op.create_table('vehicles',
- sa.Column('Id', sa.Integer(), nullable=False),
- sa.Column('Model', sa.String(), nullable=False),
- sa.Column('Year', sa.Integer(), nullable=False),
- sa.Column('LicensePlate', sa.String(), nullable=False),
- sa.Column('Type', sa.String(), nullable=False),
- sa.Column('AssignedDriverIds', sa.ARRAY(sa.Integer()), nullable=True),
- sa.Column('CurrentLocation', sa.ARRAY(sa.String()), nullable=True),
- sa.Column('Fuel', sa.Integer(), nullable=False),
- sa.Column('Mileage', sa.Integer(), nullable=False),
- sa.Column('MaintenanceNotes', sa.ARRAY(sa.String()), nullable=True),
- sa.PrimaryKeyConstraint('Id')
- )
- op.create_index(op.f('ix_vehicles_Id'), 'vehicles', ['Id'], unique=False)
- # ### end Alembic commands ###
-
-
- def downgrade() -> None:
- # ### commands auto generated by Alembic - please adjust! ###
- op.drop_index(op.f('ix_vehicles_Id'), table_name='vehicles')
- op.drop_table('vehicles')
- op.drop_index(op.f('ix_users_Id'), table_name='users')
- op.drop_table('users')
- # ### end Alembic commands ###
|