From 767fea46b791d93c32b7375e350f64bcf0d0445b Mon Sep 17 00:00:00 2001 From: sorcier Date: Fri, 6 Nov 2026 01:21:03 +0100 Subject: [PATCH] fix(cluster): auto-ensure blf_expiry and peer_port columns exist in ClusterManager constructor --- src/ClusterManager.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/ClusterManager.php b/src/ClusterManager.php index f238575..eb15d60 100644 --- a/src/ClusterManager.php +++ b/src/ClusterManager.php @@ -21,6 +21,20 @@ class ClusterManager public function __construct(?PDO $db = null) { $this->db = $db ?? Database::getConnection(); + $this->ensureColumns(); + } + + private function ensureColumns(): void + { + try { + $cols = $this->db->query("PRAGMA table_info(cluster_settings)")->fetchAll(PDO::FETCH_COLUMN, 1); + if (!in_array('blf_expiry', $cols, true)) { + $this->db->exec("ALTER TABLE cluster_settings ADD COLUMN blf_expiry INTEGER NOT NULL DEFAULT 120"); + } + if (!in_array('peer_port', $cols, true)) { + $this->db->exec("ALTER TABLE cluster_settings ADD COLUMN peer_port INTEGER NOT NULL DEFAULT 8443"); + } + } catch (\Throwable $e) {} } /**