Skip to content

Commit 2a81225

Browse files
committed
Introduce new table definition for forge_instance operational table.
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
1 parent 5a4c4f7 commit 2a81225

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

collectoss/application/db/models/augur_operations.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# encoding: utf-8
2-
from sqlalchemy import BigInteger, SmallInteger, Column, Index, Integer, String, Table, text, UniqueConstraint, Boolean, ForeignKey, update, CheckConstraint, Sequence
2+
from sqlalchemy import BigInteger, SmallInteger, Column, Index, Integer, String, Table, text, UniqueConstraint, Boolean, ForeignKey, update, CheckConstraint, Sequence, DateTime, func
33
from sqlalchemy.dialects.postgresql import TIMESTAMP
44
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
55
from sqlalchemy.exc import IntegrityError
@@ -1072,6 +1072,20 @@ def get_by_id(session, client_id):
10721072
session.rollback()
10731073
raise e
10741074

1075+
class ForgeInstance(Base):
1076+
__tablename__ = "forge_instance"
1077+
__table_args__ = { "schema": "augur_operations" }
1078+
1079+
id = Column(Integer, primary_key=True, nullable=False, comment="Internal unique identifier for this forge instance")
1080+
# platform_type stores an integer that CollectOSS maps/will map to it's internal platform
1081+
# identifer Enum (as used in ContributorUUID) for identifying the API endpoints and tasks to use for collection
1082+
platform_type = Column(Integer, nullable=False, comment="Type specifier identifying the relevant platform API interface to CollectOSS")
1083+
name = Column(String, nullable=False, comment="User-specified name for this forge instance")
1084+
# https://stackoverflow.com/a/54800233
1085+
date_added = Column(DateTime(timezone=True), nullable=False, default=func.now())
1086+
domain_name = Column(String, nullable=False, comment="The base domain name (without the scheme) where this instance is hosted")
1087+
enabled = Column(Boolean, default=True, nullable=False, comment="denotes whether collection should run for this instance")
1088+
10751089

10761090
class Subscription(Base):
10771091
__tablename__ = "subscriptions"

0 commit comments

Comments
 (0)