v0.2 fleet overhaul
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from sqlalchemy import Column, String, DateTime, Boolean, Text
|
||||
from sqlalchemy import Column, String, DateTime, Boolean, Text, Date
|
||||
from datetime import datetime
|
||||
from backend.database import Base
|
||||
|
||||
@@ -18,11 +18,15 @@ class RosterUnit(Base):
|
||||
"""
|
||||
Roster table: represents our *intended assignment* of a unit.
|
||||
This is editable from the GUI.
|
||||
|
||||
Supports multiple device types (seismograph, modem) with type-specific fields.
|
||||
"""
|
||||
__tablename__ = "roster"
|
||||
|
||||
# Core fields (all device types)
|
||||
id = Column(String, primary_key=True, index=True)
|
||||
unit_type = Column(String, default="series3")
|
||||
unit_type = Column(String, default="series3") # Backward compatibility
|
||||
device_type = Column(String, default="seismograph") # "seismograph" | "modem"
|
||||
deployed = Column(Boolean, default=True)
|
||||
retired = Column(Boolean, default=False)
|
||||
note = Column(String, nullable=True)
|
||||
@@ -30,6 +34,16 @@ class RosterUnit(Base):
|
||||
location = Column(String, nullable=True)
|
||||
last_updated = Column(DateTime, default=datetime.utcnow)
|
||||
|
||||
# Seismograph-specific fields (nullable for modems)
|
||||
last_calibrated = Column(Date, nullable=True)
|
||||
next_calibration_due = Column(Date, nullable=True)
|
||||
deployed_with_modem_id = Column(String, nullable=True) # FK to another RosterUnit
|
||||
|
||||
# Modem-specific fields (nullable for seismographs)
|
||||
ip_address = Column(String, nullable=True)
|
||||
phone_number = Column(String, nullable=True)
|
||||
hardware_model = Column(String, nullable=True)
|
||||
|
||||
|
||||
class IgnoredUnit(Base):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user