You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

61 lines
2.3 KiB

  1. """create User and Vehicle tables
  2. Revision ID: 9a0214838ac8
  3. Revises:
  4. Create Date: 2023-09-01 13:31:01.324861
  5. """
  6. from typing import Sequence, Union
  7. from alembic import op
  8. import sqlalchemy as sa
  9. # revision identifiers, used by Alembic.
  10. revision: str = '9a0214838ac8'
  11. down_revision: Union[str, None] = None
  12. branch_labels: Union[str, Sequence[str], None] = None
  13. depends_on: Union[str, Sequence[str], None] = None
  14. def upgrade() -> None:
  15. # ### commands auto generated by Alembic - please adjust! ###
  16. op.create_table('users',
  17. sa.Column('Id', sa.Integer(), nullable=False),
  18. sa.Column('Name', sa.String(), nullable=False),
  19. sa.Column('MiddleName', sa.String(), nullable=True),
  20. sa.Column('LastName', sa.String(), nullable=False),
  21. sa.Column('BirthDate', sa.DateTime(), nullable=False),
  22. sa.Column('ContactNumber', sa.String(), nullable=False),
  23. sa.Column('Email', sa.String(), nullable=False),
  24. sa.Column('Role', sa.String(), nullable=False),
  25. sa.Column('DrivingLicenseNumber', sa.String(), nullable=True),
  26. sa.Column('HashedPassword', sa.String(), nullable=False),
  27. sa.PrimaryKeyConstraint('Id')
  28. )
  29. op.create_index(op.f('ix_users_Id'), 'users', ['Id'], unique=False)
  30. op.create_table('vehicles',
  31. sa.Column('Id', sa.Integer(), nullable=False),
  32. sa.Column('Model', sa.String(), nullable=False),
  33. sa.Column('Year', sa.Integer(), nullable=False),
  34. sa.Column('LicensePlate', sa.String(), nullable=False),
  35. sa.Column('Type', sa.String(), nullable=False),
  36. sa.Column('AssignedDriverIds', sa.ARRAY(sa.Integer()), nullable=True),
  37. sa.Column('CurrentLocation', sa.ARRAY(sa.String()), nullable=True),
  38. sa.Column('Fuel', sa.Integer(), nullable=False),
  39. sa.Column('Mileage', sa.Integer(), nullable=False),
  40. sa.Column('MaintenanceNotes', sa.ARRAY(sa.String()), nullable=True),
  41. sa.PrimaryKeyConstraint('Id')
  42. )
  43. op.create_index(op.f('ix_vehicles_Id'), 'vehicles', ['Id'], unique=False)
  44. # ### end Alembic commands ###
  45. def downgrade() -> None:
  46. # ### commands auto generated by Alembic - please adjust! ###
  47. op.drop_index(op.f('ix_vehicles_Id'), table_name='vehicles')
  48. op.drop_table('vehicles')
  49. op.drop_index(op.f('ix_users_Id'), table_name='users')
  50. op.drop_table('users')
  51. # ### end Alembic commands ###