diff --git a/api/database.php b/api/database.php index 8c70c2c..df8a8fb 100644 --- a/api/database.php +++ b/api/database.php @@ -476,6 +476,45 @@ if (empty($recipeLibTables)) { ); "); } + +// Recipe tags (v2.3) — tags pour trier/filtrer "Mes recettes", gérables depuis Config +$recipeTagsTables = $db->query("SELECT name FROM sqlite_master WHERE type='table' AND name='recipe_tags'")->fetchAll(); +if (empty($recipeTagsTables)) { + $db->exec(" + CREATE TABLE recipe_tags ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + key TEXT UNIQUE NOT NULL, + label TEXT NOT NULL, + icon TEXT DEFAULT '🏷️', + sort_order INTEGER DEFAULT 0 + ); + "); + $db->exec("INSERT INTO recipe_tags (key, label, icon, sort_order) VALUES + ('cocktail', 'Cocktail', '🍹', 1), + ('sans_alcool', 'Sans alcool', '🚫', 2), + ('shot', 'Shot', '🥃', 3), + ('long_drink', 'Long drink', '🍺', 4), + ('aperitif', 'Apéritif', '🍾', 5), + ('digestif', 'Digestif', '❄️', 6), + ('rhum', 'Rhum', '🥃', 7), + ('vodka', 'Vodka', '🍸', 8), + ('gin', 'Gin', '🌿', 9), + ('whisky', 'Whisky', '🥃', 10), + ('tequila', 'Tequila', '🌵', 11), + ('vin', 'Vin', '🍷', 12), + ('champagne', 'Champagne / Mousseux', '🍾', 13), + ('acidule', 'Acidulé', '🍋', 14), + ('sucre', 'Sucré', '🍬', 15), + ('amer', 'Amer', '☕', 16), + ('epice', 'Épicé', '🌶️', 17), + ('fruite', 'Fruité', '🍊', 18), + ('herbace', 'Herbacé', '🌿', 19), + ('ete', 'Été', '☀️', 20), + ('hiver', 'Hiver', '❄️', 21), + ('soiree', 'Soirée', '🎉', 22), + ('brunch', 'Brunch', '🥂', 23) + "); +} // Internal shopping list table (v1.8.0) — used when SHOPPING_MODE=internal $shopTables = $db->query("SELECT name FROM sqlite_master WHERE type='table' AND name='shopping_list'")->fetchAll();