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.
 
 

62 lines
3.0 KiB

  1. """Edit driver assignment
  2. Revision ID: f272ebbba83d
  3. Revises: 47f450cb5e82
  4. Create Date: 2023-09-04 15:36:52.916595
  5. """
  6. from typing import Sequence, Union
  7. from alembic import op
  8. import sqlalchemy as sa
  9. from sqlalchemy.dialects import postgresql
  10. # revision identifiers, used by Alembic.
  11. revision: str = 'f272ebbba83d'
  12. down_revision: Union[str, None] = '47f450cb5e82'
  13. branch_labels: Union[str, Sequence[str], None] = None
  14. depends_on: Union[str, Sequence[str], None] = None
  15. def upgrade() -> None:
  16. # ### commands auto generated by Alembic - please adjust! ###
  17. op.drop_index('ix_vehicles_Id', table_name='vehicles')
  18. op.drop_table('vehicles')
  19. op.drop_index('ix_users_Id', table_name='users')
  20. op.drop_table('users')
  21. # ### end Alembic commands ###
  22. def downgrade() -> None:
  23. # ### commands auto generated by Alembic - please adjust! ###
  24. op.create_table('users',
  25. sa.Column('Id', sa.INTEGER(), server_default=sa.text('nextval(\'"users_Id_seq"\'::regclass)'), autoincrement=True, nullable=False),
  26. sa.Column('Name', sa.VARCHAR(), autoincrement=False, nullable=False),
  27. sa.Column('MiddleName', sa.VARCHAR(), autoincrement=False, nullable=True),
  28. sa.Column('LastName', sa.VARCHAR(), autoincrement=False, nullable=False),
  29. sa.Column('BirthDate', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
  30. sa.Column('ContactNumber', sa.VARCHAR(), autoincrement=False, nullable=False),
  31. sa.Column('Email', sa.VARCHAR(), autoincrement=False, nullable=False),
  32. sa.Column('Role', sa.VARCHAR(), autoincrement=False, nullable=False),
  33. sa.Column('DrivingLicenseNumber', sa.VARCHAR(), autoincrement=False, nullable=True),
  34. sa.Column('HashedPassword', sa.VARCHAR(), autoincrement=False, nullable=False),
  35. sa.PrimaryKeyConstraint('Id', name='users_pkey')
  36. )
  37. op.create_index('ix_users_Id', 'users', ['Id'], unique=False)
  38. op.create_table('vehicles',
  39. sa.Column('Id', sa.INTEGER(), server_default=sa.text('nextval(\'"vehicles_Id_seq"\'::regclass)'), autoincrement=True, nullable=False),
  40. sa.Column('Model', sa.VARCHAR(), autoincrement=False, nullable=False),
  41. sa.Column('Year', sa.INTEGER(), autoincrement=False, nullable=False),
  42. sa.Column('LicensePlate', sa.VARCHAR(), autoincrement=False, nullable=False),
  43. sa.Column('AssignedDriverIds', postgresql.ARRAY(sa.INTEGER()), autoincrement=False, nullable=True),
  44. sa.Column('CurrentLocation', postgresql.ARRAY(sa.VARCHAR()), autoincrement=False, nullable=True),
  45. sa.Column('Fuel', sa.INTEGER(), autoincrement=False, nullable=False),
  46. sa.Column('Mileage', sa.INTEGER(), autoincrement=False, nullable=False),
  47. sa.Column('Status', sa.VARCHAR(), autoincrement=False, nullable=False),
  48. sa.Column('Capacity', sa.INTEGER(), autoincrement=False, nullable=False),
  49. sa.Column('MaintenanceNotes', postgresql.ARRAY(sa.VARCHAR()), autoincrement=False, nullable=True),
  50. sa.PrimaryKeyConstraint('Id', name='vehicles_pkey')
  51. )
  52. op.create_index('ix_vehicles_Id', 'vehicles', ['Id'], unique=False)
  53. # ### end Alembic commands ###