- Fix sqlite3.OperationalError: the recipes table uses `title` not `name`; get_plan_slots JOIN was crashing every list_plans call with a 500, making the + New week button appear broken (plans were being created silently but the selector refresh always failed) - Add migration 032 to add UNIQUE INDEX on meal_plans(week_start) to prevent duplicate plans accumulating while the button was broken - Raise HTTP 409 on IntegrityError in create_plan so duplicates produce a clear error instead of a 500 - Fix mondayOfCurrentWeek to build the date string from local date parts instead of toISOString(), which converts through UTC and can produce the wrong calendar day for UTC+ timezones - Add planCreating/planError state to MealPlanView so button shows "Creating..." during the request and displays errors inline
4 lines
254 B
SQL
4 lines
254 B
SQL
-- 032_meal_plan_unique_week.sql
|
|
-- Prevent duplicate plans for the same week.
|
|
-- Existing duplicates must be resolved before applying (keep MIN(id) per week_start).
|
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_meal_plans_week_start ON meal_plans (week_start);
|