diff --git a/cauldron/server.py b/cauldron/server.py index 91cb305..edaa68e 100644 --- a/cauldron/server.py +++ b/cauldron/server.py @@ -244,7 +244,15 @@ def create_app() -> Flask: return None h = db.get_user_household_id(u["sub"]) if h is None: - h = sync_user_household(u["sub"]) + return sync_user_household(u["sub"]) + # Re-sync once if the row is missing mealie_group_id (added in + # migration 035). This is the upgrade-path backfill: existing + # households were created before the column existed and need a + # one-shot sync to populate it. After that this is a cheap + # short-circuit on a per-request lookup. + hh = db.get_household(h) + if hh and not hh.get("mealie_group_id"): + sync_user_household(u["sub"]) return h def monday_of(d: date) -> date: