mealie-recipes / mealie

Mealie is a self hosted recipe manager and meal planner with a RestAPI backend and a reactive frontend application built in Vue for a pleasant user experience for the whole family. Easily add recipes into your database by providing the url and mealie will automatically import the relevant data or add a family recipe with the UI editor
https://docs.mealie.io
GNU Affero General Public License v3.0
7.14k stars 716 forks source link

[BUG] - Restoring mealie 2.0 does not work. Users are imported before households #4433

Open Bretterteig opened 3 hours ago

Bretterteig commented 3 hours ago

First Check

What is the issue you are experiencing?

I wanted to migrate my Mealie instance from sqlite to postgres. However, I cannot restore the created backup. It seems the new households feature is not yet properly implemented in the restore.

It tries to import users before households, leading to a FK error as the households do not yet exist.

Steps to Reproduce

1) Create a backup 2) Delete DB 3) Restore

Please provide relevant logs

sqlalchemy.exc.IntegrityError: (psycopg2.errors.ForeignKeyViolation) insert or update on table "users" violates foreign key constraint "fk_users_household_id" DETAIL: Key (household_id)=(ec8b8b72-1cd1-4081-80f0-fec7adae6f52) is not present in table "households".

Mealie Version

ghcr.io/mealie-recipes/mealie:latest (v2.0.0)?

Deployment

Unraid

Additional Deployment Details

No response

boc-the-git commented 3 hours ago

Please get your version details from the settings page.

But yea, from the logs, this error seems to support your hypothesis.