From be8b011c9c4c44f8de99d5cf19ebd1dae5b7dfe9 Mon Sep 17 00:00:00 2001 From: Blaise Thompson Date: Tue, 12 Nov 2019 08:32:41 -0600 Subject: coloring --- shopdb/_status.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 shopdb/_status.py (limited to 'shopdb/_status.py') diff --git a/shopdb/_status.py b/shopdb/_status.py new file mode 100644 index 0000000..4011048 --- /dev/null +++ b/shopdb/_status.py @@ -0,0 +1,30 @@ +__all__ = ["Status"] + + +import enum +from sqlalchemy import Column, Integer, String, DateTime, Enum +from sqlalchemy.orm import relationship +from sqlalchemy import ForeignKey +from ._base import Base, engine + + +class StatusValues(enum.Enum): + unstarted = 1 + proceeding = 2 + completed = 3 + deferred = 4 + waiting = 5 + canceled = 6 + + +class Status(Base): + __tablename__ = 'event' + id = Column(Integer, primary_key=True) + comment = Column(String) + value = Column(Enum(StatusValues)) + timestamp = Column(DateTime) + job_id = Column(Integer, ForeignKey("jobs.id")) + job = relationship("Job", back_populates="status_updates") + + def __repr__(self): + return "" % (self.value) -- cgit v1.2.3