25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

29 lines
945 B

  1. # Postgres table model for vehicles
  2. from sqlalchemy import (
  3. Column,
  4. Float,
  5. Integer,
  6. String,
  7. ARRAY,
  8. )
  9. from sqlalchemy.orm import relationship
  10. from db.base import Base
  11. class Vehicle(Base):
  12. Id = Column(Integer, primary_key=True, index=True)
  13. Model = Column(String, nullable=False)
  14. Year = Column(Integer, nullable=False)
  15. LicensePlate = Column(String, nullable=False)
  16. Type = Column(String, nullable=False)
  17. CurrentLocation = Column(ARRAY(String), nullable=True)
  18. Fuel = Column(Float, nullable=False)
  19. Mileage = Column(Float, nullable=False)
  20. Status = Column(String, nullable=False)
  21. Capacity = Column(Integer, nullable=False)
  22. DriverHistory = Column(ARRAY(Integer), nullable=True)
  23. driver = relationship("User", back_populates="vehicle")
  24. auction = relationship("Auction", back_populates="vehicle")
  25. maintenanceJobs = relationship("MaintenanceJob", back_populates="Vehicle")