|
1 | 1 | # 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 |
3 | 3 | from sqlalchemy.dialects.postgresql import TIMESTAMP |
4 | 4 | from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound |
5 | 5 | from sqlalchemy.exc import IntegrityError |
@@ -1072,6 +1072,20 @@ def get_by_id(session, client_id): |
1072 | 1072 | session.rollback() |
1073 | 1073 | raise e |
1074 | 1074 |
|
| 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 | + |
1075 | 1089 |
|
1076 | 1090 | class Subscription(Base): |
1077 | 1091 | __tablename__ = "subscriptions" |
|
0 commit comments