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) {} } /**