From be8b011c9c4c44f8de99d5cf19ebd1dae5b7dfe9 Mon Sep 17 00:00:00 2001 From: Blaise Thompson Date: Tue, 12 Nov 2019 08:32:41 -0600 Subject: coloring --- shopdb/_job.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 shopdb/_job.py (limited to 'shopdb/_job.py') diff --git a/shopdb/_job.py b/shopdb/_job.py new file mode 100644 index 0000000..13f2988 --- /dev/null +++ b/shopdb/_job.py @@ -0,0 +1,25 @@ +__all__ = ["Job"] + + +import enum +from sqlalchemy import Column, Integer, String, Enum +from sqlalchemy.orm import relationship +from ._base import Base, engine +from ._status import Status + + +class JobPriorities(enum.Enum): + high = 1 + medium = 2 + low = 3 + + +class Job(Base): + __tablename__ = 'jobs' + id = Column(Integer, primary_key=True) + name = Column(String) + priority = Column(Enum(JobPriorities), default="medium") + status_updates = relationship("Status", back_populates="job") + + def __repr__(self): + return "" % (self.name) -- cgit v1.2.3