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.
This commit is contained in:
Théophile Diot 2024-08-07 10:59:54 +01:00
parent 081d953bdb
commit afabcf6e60
No known key found for this signature in database
GPG key ID: FA995104A0BA376A
2 changed files with 2 additions and 1 deletions

View file

@ -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,
)
)

View file

@ -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))