|
12345678910111213141516171819202122232425262728 |
- # Postgres table model for vehicles
- from sqlalchemy import (
- Column,
- Float,
- Integer,
- String,
- ARRAY,
- )
- from sqlalchemy.orm import relationship
- from db.base import Base
-
-
- class Vehicle(Base):
- Id = Column(Integer, primary_key=True, index=True)
- Model = Column(String, nullable=False)
- Year = Column(Integer, nullable=False)
- LicensePlate = Column(String, nullable=False)
- Type = Column(String, nullable=False)
- CurrentLocation = Column(ARRAY(String), nullable=True)
- Fuel = Column(Float, nullable=False)
- Mileage = Column(Float, nullable=False)
- Status = Column(String, nullable=False)
- Capacity = Column(Integer, nullable=False)
- DriverHistory = Column(ARRAY(Integer), nullable=True)
- driver = relationship("User", back_populates="vehicle")
- auction = relationship("Auction", back_populates="vehicle")
- maintenanceJobs = relationship("MaintenanceJob", back_populates="Vehicle")
-
|