Actualiser api/database.php
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
Security Scan (Trivy) / Trivy — Docker image scan (push) Has been cancelled
Security Scan (Trivy) / Trivy — Filesystem scan (push) Has been cancelled
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
Security Scan (Trivy) / Trivy — Docker image scan (push) Has been cancelled
Security Scan (Trivy) / Trivy — Filesystem scan (push) Has been cancelled
This commit is contained in:
@@ -515,6 +515,28 @@ if (empty($recipeTagsTables)) {
|
|||||||
('brunch', 'Brunch', '🥂', 23)
|
('brunch', 'Brunch', '🥂', 23)
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
// Custom quantity units (v2.4) — unités personnalisées (ex: kg, L) avec facteur de conversion vers pz/g/ml, gérables depuis Config
|
||||||
|
$customUnitsTables = $db->query("SELECT name FROM sqlite_master WHERE type='table' AND name='custom_units'")->fetchAll();
|
||||||
|
if (empty($customUnitsTables)) {
|
||||||
|
$db->exec("
|
||||||
|
CREATE TABLE custom_units (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
key TEXT UNIQUE NOT NULL,
|
||||||
|
label TEXT NOT NULL,
|
||||||
|
icon TEXT DEFAULT '📏',
|
||||||
|
base_unit TEXT NOT NULL DEFAULT 'g',
|
||||||
|
factor REAL NOT NULL DEFAULT 1,
|
||||||
|
sort_order INTEGER DEFAULT 0
|
||||||
|
);
|
||||||
|
");
|
||||||
|
}
|
||||||
|
// Add display_unit_key column to products if missing — unité personnalisée a afficher pour ce produit
|
||||||
|
$prodColsUnits = array_column($db->query("PRAGMA table_info(products)")->fetchAll(), 'name');
|
||||||
|
if (!in_array('display_unit_key', $prodColsUnits)) {
|
||||||
|
try { $db->exec("ALTER TABLE products ADD COLUMN display_unit_key TEXT DEFAULT NULL"); }
|
||||||
|
catch (PDOException $e) { if (strpos($e->getMessage(), 'duplicate column') === false) throw $e; }
|
||||||
|
}
|
||||||
|
// Internal shopping list table (v1.8.0) — used when SHOPPING_MODE=internal
|
||||||
|
|
||||||
// Internal shopping list table (v1.8.0) — used when SHOPPING_MODE=internal
|
// 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();
|
$shopTables = $db->query("SELECT name FROM sqlite_master WHERE type='table' AND name='shopping_list'")->fetchAll();
|
||||||
|
|||||||
Reference in New Issue
Block a user