Skip to content

Commit

Permalink
Add Edition.kind column
Browse files Browse the repository at this point in the history
This enumeration column allows us to classify the edition's kind, which
is useful information for edition dashboards.
  • Loading branch information
jonathansick committed Oct 16, 2020
1 parent f5f2813 commit 72ed0f0
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions keeper/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,30 @@ def deprecate_build(self) -> None:
self.date_ended = datetime.now()


class EditionKind(enum.Enum):
"""Classification of the edition.
This classification is primarily used by edition dashboards.
"""

main = 1
"""The main (default) edition."""

release = 2
"""A release."""

draft = 3
"""A draft edition (not a release)."""

major = 4
"""An edition that tracks a major version (for the latest minor or
patch version).
"""

minor = 2
"""An edition that tracks a minor version (for the latest patch.)"""


class Edition(db.Model): # type: ignore
"""DB model for Editions. Editions are fixed-location publications of the
docs. Editions are updated by new builds; though not all builds are used
Expand Down Expand Up @@ -860,6 +884,16 @@ class Edition(db.Model): # type: ignore
pending_rebuild = db.Column(db.Boolean, default=False, nullable=False)
"""Flag indicating if a rebuild is pending work by the rebuild task."""

kind = db.Column(
db.Enum(EditionKind), default=EditionKind.draft, nullable=False
)
"""The edition's kind.
See also
--------
EditionKind
"""

# Relationships
build = db.relationship("Build", uselist=False)
"""One-to-one relationship with the `Build` resource."""
Expand Down

0 comments on commit 72ed0f0

Please sign in to comment.