feat: structure meal planning taxonomy and favorites

This commit is contained in:
OpenClaw Bot
2026-05-12 17:15:31 +02:00
parent cef366cce4
commit 58a76ee02d
9 changed files with 442 additions and 20 deletions
+28
View File
@@ -1482,6 +1482,34 @@ const MIGRATIONS = [
`);
},
},
{
version: 41,
description: 'Structured meal taxonomy and leftover links',
up(database) {
const columns = (table) => new Set(database.prepare(`PRAGMA table_info(${table})`).all().map((row) => row.name));
const addColumn = (table, name, definition) => {
if (!columns(table).has(name)) database.exec(`ALTER TABLE ${table} ADD COLUMN ${name} ${definition}`);
};
addColumn('recipes', 'meal_category', "TEXT");
addColumn('recipes', 'protein', "TEXT");
addColumn('recipes', 'style', "TEXT");
addColumn('recipes', 'tags_json', "TEXT");
addColumn('meals', 'meal_category', "TEXT");
addColumn('meals', 'protein', "TEXT");
addColumn('meals', 'style', "TEXT");
addColumn('meals', 'leftover_from_meal_id', "INTEGER REFERENCES meals(id) ON DELETE SET NULL");
addColumn('meals', 'source_plan_id', "TEXT");
database.exec(`
CREATE INDEX IF NOT EXISTS idx_recipes_meal_taxonomy ON recipes(meal_category, protein, style);
CREATE INDEX IF NOT EXISTS idx_meals_meal_taxonomy ON meals(meal_category, protein, style);
CREATE INDEX IF NOT EXISTS idx_meals_leftover_from ON meals(leftover_from_meal_id);
CREATE INDEX IF NOT EXISTS idx_meals_source_plan ON meals(source_plan_id);
`);
},
},
];
/**