discover: backfill mealie_group_id for existing households
current_household_id() short-circuited on member-row presence and never called sync, so the mealie_group_id column added by migration 035 stayed NULL on existing households. Now: if the row is missing group_id, re-run sync_user_household once to backfill from who_am_i. After backfill the check is a cheap row read.
This commit is contained in:
parent
fb94da7cce
commit
b41c93e559
1 changed files with 9 additions and 1 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue