選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

63 行
2.4 KiB

  1. """Fix
  2. Revision ID: a92339978636
  3. Revises: 95369c9d99cc
  4. Create Date: 2023-09-04 16:03:42.207089
  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 = 'a92339978636'
  11. down_revision: Union[str, None] = '95369c9d99cc'
  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('vehicle',
  17. sa.Column('Id', sa.Integer(), nullable=False),
  18. sa.Column('Model', sa.String(), nullable=False),
  19. sa.Column('Year', sa.Integer(), nullable=False),
  20. sa.Column('LicensePlate', sa.String(), nullable=False),
  21. sa.Column('CurrentLocation', sa.ARRAY(sa.String()), nullable=True),
  22. sa.Column('Fuel', sa.Integer(), nullable=False),
  23. sa.Column('Mileage', sa.Integer(), nullable=False),
  24. sa.Column('Status', sa.String(), nullable=False),
  25. sa.Column('Capacity', sa.Integer(), nullable=False),
  26. sa.Column('MaintenanceNotes', sa.ARRAY(sa.String()), nullable=True),
  27. sa.PrimaryKeyConstraint('Id')
  28. )
  29. op.create_index(op.f('ix_vehicle_Id'), 'vehicle', ['Id'], unique=False)
  30. op.create_table('user',
  31. sa.Column('Id', sa.Integer(), nullable=False),
  32. sa.Column('Name', sa.String(), nullable=False),
  33. sa.Column('MiddleName', sa.String(), nullable=True),
  34. sa.Column('LastName', sa.String(), nullable=False),
  35. sa.Column('BirthDate', sa.DateTime(), nullable=False),
  36. sa.Column('ContactNumber', sa.String(), nullable=False),
  37. sa.Column('Email', sa.String(), nullable=False),
  38. sa.Column('Role', sa.String(), nullable=False),
  39. sa.Column('DrivingLicenseNumber', sa.String(), nullable=True),
  40. sa.Column('AssignedVehicle', sa.Integer(), nullable=True),
  41. sa.Column('HashedPassword', sa.String(), nullable=False),
  42. sa.ForeignKeyConstraint(['AssignedVehicle'], ['vehicle.Id'], ),
  43. sa.PrimaryKeyConstraint('Id')
  44. )
  45. op.create_index(op.f('ix_user_Id'), 'user', ['Id'], unique=False)
  46. # ### end Alembic commands ###
  47. def downgrade() -> None:
  48. # ### commands auto generated by Alembic - please adjust! ###
  49. op.drop_index(op.f('ix_user_Id'), table_name='user')
  50. op.drop_table('user')
  51. op.drop_index(op.f('ix_vehicle_Id'), table_name='vehicle')
  52. op.drop_table('vehicle')
  53. # ### end Alembic commands ###