Skip to content

Commit

Permalink
feat: Update status column default value in Instances table
Browse files Browse the repository at this point in the history
The default value of the `status` column in the `Instances` table has been changed from "up" to "loading". This update ensures that new instances are marked as "loading" by default until their health status is determined.
  • Loading branch information
TheophileDiot committed Aug 7, 2024
1 parent 081d953 commit afabcf6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/common/db/Database.py
Original file line number Diff line number Diff line change
Expand Up @@ -3111,6 +3111,7 @@ def update_instances(self, instances: List[Dict[str, Any]], method: str, changed
hostname=instance["hostname"],
port=instance["env"].get("API_HTTP_PORT", 5000),
server_name=instance["env"].get("API_SERVER_NAME", "bwapi"),
status="up" if instance.get("health", True) else "down",
method=method,
)
)
Expand Down
2 changes: 1 addition & 1 deletion src/common/db/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class Instances(Base):
hostname = Column(String(256), primary_key=True)
port = Column(Integer, nullable=False)
server_name = Column(String(256), nullable=False)
status = Column(INSTANCE_STATUS_ENUM, nullable=True, default="up")
status = Column(INSTANCE_STATUS_ENUM, nullable=True, default="loading")
method = Column(METHODS_ENUM, nullable=False, default="manual")
creation_date = Column(DateTime, nullable=False, server_default=func.now())
last_seen = Column(DateTime, nullable=True, server_default=func.now(), onupdate=partial(datetime.now, timezone.utc))
Expand Down

0 comments on commit afabcf6

Please sign in to comment.