|
- # Postgres table model for vehicles
- from sqlalchemy import (
- Column,
- 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(Integer, nullable=False)
- Mileage = Column(Integer, 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")
-
|