From 3bfa89e61d16ebb50c5e3b7658021f8cf32b0926 Mon Sep 17 00:00:00 2001 From: morgane Date: Thu, 25 Jun 2026 20:21:34 +0000 Subject: [PATCH] Actualiser api/database.php --- api/database.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/api/database.php b/api/database.php index 601e856..a807006 100644 --- a/api/database.php +++ b/api/database.php @@ -567,6 +567,12 @@ if (!in_array('display_unit_key', $prodColsUnits)) { try { $db->exec("ALTER TABLE products ADD COLUMN nutriments_json TEXT DEFAULT NULL"); } catch (PDOException $e) { if (strpos($e->getMessage(), 'duplicate column') === false) throw $e; } } + + // Add tags column to products if missing (bugfix: insert referenced a column never created) + if (!in_array('tags', $prodCols2)) { + try { $db->exec("ALTER TABLE products ADD COLUMN tags TEXT DEFAULT NULL"); } + catch (PDOException $e) { if (strpos($e->getMessage(), 'duplicate column') === false) throw $e; } + } } /** @@ -894,4 +900,4 @@ function getVacuumExpiryDaysPHP(int $baseDays): int { if ($baseDays <= 30) return (int)round($baseDays * 2.5); if ($baseDays <= 90) return (int)round($baseDays * 2.5); return (int)round($baseDays * 1.5); -} +} \ No newline at end of file