diff --git a/api/database.php b/api/database.php index a807006..271aa39 100644 --- a/api/database.php +++ b/api/database.php @@ -489,6 +489,14 @@ if (empty($recipeTagsTables)) { sort_order INTEGER DEFAULT 0 ); "); +} +// Migration: add keywords column to recipe_tags if missing +$rtCols = array_column($db->query("PRAGMA table_info(recipe_tags)")->fetchAll(), 'name'); +if (!in_array('keywords', $rtCols)) { + try { $db->exec("ALTER TABLE recipe_tags ADD COLUMN keywords TEXT DEFAULT ''"); } + catch (PDOException $e) { if (strpos($e->getMessage(), 'duplicate column') === false) throw $e; } +} + $db->exec("INSERT INTO recipe_tags (key, label, icon, sort_order) VALUES ('cocktail', 'Cocktail', '🍹', 1), ('sans_alcool', 'Sans alcool', '🚫', 2),