Add service information feature with version checks
All checks were successful
PostgreSQL Compatibility Matrix / PG14 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG15 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG16 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG17 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG18 smoke (push) Successful in 8s

This commit introduces a new "Service Information" section displaying runtime details, installed version, and update status for the NexaPG application. It includes backend API endpoints, database schema changes, and a corresponding frontend page that allows users to check for updates against the official repository. The `.env` example now includes an `APP_VERSION` variable, and related documentation has been updated.
This commit is contained in:
2026-02-13 08:54:13 +01:00
parent fd24a3a548
commit 0445a72764
12 changed files with 462 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ from app.models.models import (
EmailNotificationSettings,
Metric,
QueryStat,
ServiceInfoSettings,
Target,
TargetOwner,
User,
@@ -15,6 +16,7 @@ __all__ = [
"Target",
"Metric",
"QueryStat",
"ServiceInfoSettings",
"AuditLog",
"AlertDefinition",
"EmailNotificationSettings",

View File

@@ -147,6 +147,25 @@ class EmailNotificationSettings(Base):
)
class ServiceInfoSettings(Base):
__tablename__ = "service_info_settings"
id: Mapped[int] = mapped_column(Integer, primary_key=True)
current_version: Mapped[str] = mapped_column(String(64), nullable=False, default="0.1.0")
release_check_url: Mapped[str | None] = mapped_column(String(500), nullable=True)
latest_version: Mapped[str | None] = mapped_column(String(64), nullable=True)
update_available: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
last_checked_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
last_check_error: Mapped[str | None] = mapped_column(Text, nullable=True)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False, server_default=func.now())
updated_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True),
nullable=False,
server_default=func.now(),
onupdate=func.now(),
)
class AlertNotificationEvent(Base):
__tablename__ = "alert_notification_events"
__table_args__ = (UniqueConstraint("alert_key", "target_id", "severity", name="uq_alert_notif_event_key_target_sev"),)