added puck events
This commit is contained in:
@ -1,8 +1,7 @@
|
||||
from sqlalchemy import Column, Integer, String, Date, ForeignKey, JSON, Interval, DateTime, Boolean
|
||||
from sqlalchemy import Column, Integer, String, Date, ForeignKey, JSON, DateTime, Boolean
|
||||
from sqlalchemy.orm import relationship
|
||||
from .database import Base
|
||||
from datetime import datetime, timedelta
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class Shipment(Base):
|
||||
@ -118,6 +117,7 @@ class Puck(Base):
|
||||
dewar_id = Column(Integer, ForeignKey('dewars.id'))
|
||||
dewar = relationship("Dewar", back_populates="pucks")
|
||||
samples = relationship("Sample", back_populates="puck")
|
||||
events = relationship("PuckEvent", back_populates="puck")
|
||||
|
||||
|
||||
class Sample(Base):
|
||||
@ -168,13 +168,13 @@ class SampleEvent(Base):
|
||||
|
||||
sample = relationship("Sample", back_populates="events")
|
||||
|
||||
#class PuckEvent(Base):
|
||||
# __tablename__ = "sample_events"
|
||||
#
|
||||
# id = Column(Integer, primary_key=True, index=True)
|
||||
# puck_id = Column(Integer, ForeignKey('puck.id'))
|
||||
# tell_position = Column(String(255), nullable=True)
|
||||
# event_type = Column(String(255), index=True)
|
||||
# timestamp = Column(DateTime, default=datetime.utcnow)
|
||||
#
|
||||
# sample = relationship("Sample", back_populates="events")
|
||||
class PuckEvent(Base):
|
||||
__tablename__ = "puck_events"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
puck_id = Column(Integer, ForeignKey('pucks.id'))
|
||||
tell_position = Column(String(255), nullable=True)
|
||||
event_type = Column(String(255), index=True)
|
||||
timestamp = Column(DateTime, default=datetime.utcnow)
|
||||
|
||||
puck = relationship("Puck", back_populates="events")
|
Reference in New Issue
Block a user