From afabcf6e60b83f304513a07dbe4784174fdb7fcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Diot?= Date: Wed, 7 Aug 2024 10:59:54 +0100 Subject: [PATCH] feat: Update status column default value in Instances table 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. --- src/common/db/Database.py | 1 + src/common/db/model.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/db/Database.py b/src/common/db/Database.py index 166fb0388..2d883877f 100644 --- a/src/common/db/Database.py +++ b/src/common/db/Database.py @@ -3111,6 +3111,7 @@ class Database: 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, ) ) diff --git a/src/common/db/model.py b/src/common/db/model.py index 49d439698..0f64c714c 100644 --- a/src/common/db/model.py +++ b/src/common/db/model.py @@ -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))