From 22cf7914a637ec047427f71881f8dd050ebee5e3 Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 15 Jan 2024 23:23:33 +0000 Subject: [PATCH] [pools] add lastupdated column if needed, fixes #1013 --- ext/pools/main.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ext/pools/main.php b/ext/pools/main.php index 66744611..c0fc0beb 100644 --- a/ext/pools/main.php +++ b/ext/pools/main.php @@ -180,6 +180,17 @@ class Pools extends Extension $database->standardise_boolean("pools", "public"); $this->set_version("ext_pools_version", 4); } + + if ($this->get_version("ext_pools_version") < 5) { + // earlier versions of the table-creation code added the lastupdated + // column non-deterministically, so let's check if it is there and + // add it if needed. + $cols = $database->raw_db()->describe("pools"); + if(!array_key_exists("lastupdated", $cols)) { + $database->execute("ALTER TABLE pools ADD COLUMN lastupdated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"); + } + $this->set_version("ext_pools_version", 5); + } } // Add a block to the Board Config / Setup