Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - Restoring backup from v1.0.0beta-5 to v1.2.0 - recipes didn't migrate properly #3218

Closed
5 of 6 tasks
di5cord20 opened this issue Feb 24, 2024 · 5 comments
Closed
5 of 6 tasks
Labels
bug Something isn't working triage

Comments

@di5cord20
Copy link

First Check

  • This is not a feature request.
  • I added a very descriptive title to this issue (title field is above this).
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the Mealie documentation, with the integrated search.
  • I already read the docs and didn't find an answer.
  • This issue can be replicated on the demo site (https://demo.mealie.io/).

What is the issue you are experiencing?

I installed a new container with v1.2.0. I then uploaded the backup I made on v1.0.0beta-5. After restoring the backup on v1.2.0, I can login and see only 1 recipe in the UI. All tags, categories, and cookbooks are visible. I can see the recipes inside /mealie/recipes folders ... but for whatever reason, only 1 recipe is shown via the web UI.

Screenshot from 2024-02-24 14-31-54

Steps to Reproduce

  1. Create backup on v1.0.0beta-5
  2. upload backup to v1.2.0
  3. restore backup

Please provide relevant logs

24/02/2024
14:04:20
INFO: 24-Feb-24 14:04:20 	initializing backup restore
24/02/2024
14:04:20
INFO: 24-Feb-24 14:04:20 	dropping all database tables
24/02/2024
14:04:20
INFO: 24-Feb-24 14:04:20 	importing database tables
24/02/2024
14:04:20
INFO: 24-Feb-24 14:04:20 	Context impl SQLiteImpl.
24/02/2024
14:04:20
INFO: 24-Feb-24 14:04:20 	Will assume non-transactional DDL.
24/02/2024
14:04:20
INFO: 24-Feb-24 14:04:20 	Running upgrade  -> 6b0f5f32d602, Initial tables
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Running upgrade 6b0f5f32d602 -> 263dd6707191, convert quantity from integer to float
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Running upgrade 263dd6707191 -> f1a2dbee5fe9, Add original_text column to recipes_ingredients
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Running upgrade f1a2dbee5fe9 -> 59eb59135381, add tags to cookbooks
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Running upgrade 59eb59135381 -> 09dfc897ad62, add require_all for cookbook filters
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Running upgrade 09dfc897ad62 -> ab0bae02578f, Add use_abbreviation column to ingredients
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Running upgrade ab0bae02578f -> f30cf048c228, add new webhook fields
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Running upgrade f30cf048c228 -> 188374910655, add login_attemps and locked_at field to user table
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Running upgrade 188374910655 -> 089bfa50d0ed, Add is_ocr_recipe column to recipes
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Running upgrade 089bfa50d0ed -> 44e8d670719d, add extras to shopping lists, list items, and ingredient foods
24/02/2024
14:04:21
WARNING: 24-Feb-24 14:04:21 	Removing row from table recipes because of invalid foreign key user_id: 00cbcd4d3527435785a9627d439a5168
24/02/2024
14:04:21
WARNING: 24-Feb-24 14:04:21 	Row: {'created_at': datetime.datetime(2022, 10, 24, 21, 10, 24, 953404), 'update_at': datetime.datetime(2022, 10, 24, 21, 40, 23, 136140), 'id': '113307f322e849e7b199f6c5b0a119f2', 'slug': 'caramel-apple-upside-down-cake-is-the-perfect-fall-dessert', 'group_id': '4cc3168474144d81a63c17c2fdbf6f1d', 'user_id': '00cbcd4d3527435785a9627d439a5168', 'name': 'Caramel Apple Upside Down Cake Is The PERFECT Fall Dessert', 'description': 'Spice cake, meet caramel apples.', 'image': 'SWPK', 'total_time': None, 'prep_time': None, 'perform_time': None, 'cook_time': None, 'recipe_yield': '', 'recipeCuisine': None, 'rating': None, 'org_url': 'https://www.delish.com/cooking/recipe-ideas/a22700524/caramel-apple-upside-down-cake-recipe/', 'date_added': datetime.date(2022, 10, 24), 'date_updated': datetime.datetime(2022, 10, 24, 21, 40, 23, 131979), 'is_ocr_recipe': False}
24/02/2024
14:04:21
WARNING: 24-Feb-24 14:04:21 	Removing row from table recipes because of invalid foreign key user_id: 00cbcd4d3527435785a9627d439a5168
24/02/2024
14:04:21
WARNING: 24-Feb-24 14:04:21 	Row: {'created_at': datetime.datetime(2022, 10, 24, 21, 11, 37, 353022), 'update_at': datetime.datetime(2022, 10, 24, 21, 40, 42, 883999), 'id': '077eae77ba3048eb882575a12e327254', 'slug': 'rough-apple-galette', 'group_id': '4cc3168474144d81a63c17c2fdbf6f1d', 'user_id': '00cbcd4d3527435785a9627d439a5168', 'name': 'Rough Apple Galette', 'description': '', 'image': 'cRti', 'total_time': None, 'prep_time': None, 'perform_time': None, 'cook_time': None, 'recipe_yield': '6 servings', 'recipeCuisine': None, 'rating': None, 'org_url': 'http://www.foodnetwork.ca/recipe/rough-apple-galette/8365/', 'date_added': datetime.date(2022, 10, 24), 'date_updated': datetime.datetime(2022, 10, 24, 21, 40, 42, 876516), 'is_ocr_recipe': False}
24/02/2024
14:04:21
WARNING: 24-Feb-24 14:04:21 	Removing row from table recipes because of invalid foreign key user_id: 00cbcd4d3527435785a9627d439a5168
24/02/2024
14:04:21
WARNING: 24-Feb-24 14:04:21 	Row: {'created_at': datetime.datetime(2022, 10, 24, 21, 15, 15, 189628), 'update_at': datetime.datetime(2023, 7, 7, 21, 35, 20, 294929), 'id': '49be5bf95a8f4afeabf7900642817837', 'slug': 'best-big-fat-chewy-chocolate-chip-cookie', 'group_id': '4cc3168474144d81a63c17c2fdbf6f1d', 'user_id': '00cbcd4d3527435785a9627d439a5168', 'name': 'Best Big, Fat, Chewy Chocolate Chip Cookie', 'description': 'Make bakery-style chocolate chip cookies with this easy recipe.', 'image': 'kxHY', 'total_time': '40 Minutes', 'prep_time': '10 Minutes', 'perform_time': '15 Minutes', 'cook_time': None, 'recipe_yield': '18 servings', 'recipeCuisine': None, 'rating': 4, 'org_url': 'https://www.allrecipes.com/recipe/25037/best-big-fat-chewy-chocolate-chip-cookie/', 'date_added': datetime.date(2022, 10, 24), 'date_updated': datetime.datetime(2023, 7, 7, 21, 35, 20, 285111), 'is_ocr_recipe': False}
24/02/2024
14:04:21
WARNING: 24-Feb-24 14:04:21 	Removing row from table recipes because of invalid foreign key user_id: 00cbcd4d3527435785a9627d439a5168
24/02/2024
14:04:21
WARNING: 24-Feb-24 14:04:21 	Row: {'created_at': datetime.datetime(2022, 10, 24, 21, 51, 59, 411065), 'update_at': datetime.datetime(2022, 10, 24, 21, 54, 53, 433519), 'id': 'e15e6de3c40743128ad9271b8125dc88', 'slug': 'gail-s-chocolate-chip-cookies', 'group_id': '4cc3168474144d81a63c17c2fdbf6f1d', 'user_id': '00cbcd4d3527435785a9627d439a5168', 'name': "Gail's Chocolate Chip Cookies", 'description': 'Makes about 7 to 8 dozen yummy cookies, freezes well as you know!', 'image': None, 'total_time': None, 'prep_time': None, 'perform_time': None, 'cook_time': None, 'recipe_yield': None, 'recipeCuisine': None, 'rating': None, 'org_url': None, 'date_added': datetime.date(2022, 10, 24), 'date_updated': datetime.datetime(2022, 10, 24, 21, 54, 53, 427851), 'is_ocr_recipe': False}

many more similar recipes follow ... and then

24/02/2024
14:04:21
WARNING: 24-Feb-24 14:04:21 	Removing row from table cookbooks_to_categories because of invalid foreign key category_id: 7c074590ba784dc09dc578aeb0e43c93
24/02/2024
14:04:21
WARNING: 24-Feb-24 14:04:21 	Row: {'cookbook_id': 'fa8f41f71ca84bc88dd4e0e0f419db78', 'category_id': '7c074590ba784dc09dc578aeb0e43c93'}
24/02/2024
14:04:21
WARNING: 24-Feb-24 14:04:21 	Removing row from table cookbooks_to_categories because of invalid foreign key category_id: f464c44a0a2d40d0bdc6419cbb7d5e83
24/02/2024
14:04:21
WARNING: 24-Feb-24 14:04:21 	Row: {'cookbook_id': 'fa8f41f71ca84bc88dd4e0e0f419db78', 'category_id': 'f464c44a0a2d40d0bdc6419cbb7d5e83'}
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Database connection established.
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Context impl SQLiteImpl.
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Will assume non-transactional DDL.
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Migration needed. Performing migration...
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Context impl SQLiteImpl.
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Will assume non-transactional DDL.
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Running upgrade 44e8d670719d -> 2ea7a807915c, add recipe_timeline_events table
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Running upgrade 2ea7a807915c -> 1923519381ad, added recipe last made timestamp
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Running upgrade 1923519381ad -> 167eb69066ad, add recipe_scale to shopping list item ref
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Running upgrade 167eb69066ad -> 165d943c64ee, add related user to mealplan
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Running upgrade 165d943c64ee -> ff5f73b01a7a, add missing foreign key and order indices
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Running upgrade ff5f73b01a7a -> 16160bf731a0, add more indices necessary for search
24/02/2024
14:04:21
INFO: 24-Feb-24 14:04:21 	Running upgrade 16160bf731a0 -> 5ab195a474eb, add normalized search properties
24/02/2024
14:04:22
INFO: 24-Feb-24 14:04:22 	Running upgrade 5ab195a474eb -> b04a08da2108, added shopping list label settings
24/02/2024
14:04:22
INFO: 24-Feb-24 14:04:22 	Running upgrade b04a08da2108 -> 38514b39a824, add auth_method to user table
24/02/2024
14:04:22
INFO: 24-Feb-24 14:04:22 	Running upgrade 38514b39a824 -> b3dbb554ba53, postgres fuzzy search
24/02/2024
14:04:22
INFO: 24-Feb-24 14:04:22 	Running upgrade b3dbb554ba53 -> 04ac51cbe9a4, added group slug
24/02/2024
14:04:22
INFO: 24-Feb-24 14:04:22 	Running upgrade 04ac51cbe9a4 -> 1825b5225403, added recipe note to shopping list recipe ref
24/02/2024
14:04:22
INFO: 24-Feb-24 14:04:22 	Running upgrade 1825b5225403 -> bcfdad6b7355, remove tool name and slug unique contraints
24/02/2024
14:04:22
INFO: 24-Feb-24 14:04:22 	Running upgrade bcfdad6b7355 -> 0341b154f79a, added normalized unit and food names
24/02/2024
14:04:22
INFO: 24-Feb-24 14:04:22 	Running upgrade 0341b154f79a -> dded3119c1fe, added unique constraints
24/02/2024
14:04:22
INFO: 24-Feb-24 14:04:22 	Running upgrade dded3119c1fe -> ba1e4a6cfe99, added plural names and alias tables for foods and units
24/02/2024
14:04:22
INFO: 24-Feb-24 14:04:22 	Checking for migration data fixes
24/02/2024
14:04:22
WARNING: 24-Feb-24 14:04:22 	"get_all" method is deprecated; use "page_all" instead
24/02/2024
14:04:22
INFO: 24-Feb-24 14:04:22 	database tables imported successfully
24/02/2024
14:04:22
INFO: 24-Feb-24 14:04:22 	restoring data directory
24/02/2024
14:04:22
INFO: 24-Feb-24 14:04:22 	data directory restored successfully
24/02/2024
14:04:22
INFO: 24-Feb-24 14:04:22 	backup restore complete
24/02/2024
14:04:22
INFO:     192.168.1.100:45160 - "POST /api/admin/backups/mealie_2024.02.24.13.45.29.zip/restore HTTP/1.1" 200 OK

Note: 192.168.1.100 is my local Nginx Proxy Manager.

Mealie Version

v.1.2.0

Deployment

Docker (Linux)

Additional Deployment Details

services:
  mealie:
    image: ghcr.io/mealie-recipes/mealie:latest
    container_name: mealie
    networks:
      - default
    ports:
      - $MEALIE_PORT:9000
    deploy:
      resources:
        limits:
          memory: 1000M
    volumes:
      - $DOCKERDIR/appdata/mealie:/app/data/
    environment:
      - ALLOW_SIGNUP=true
      - PUID=$PUID
      - PGID=$PGID
      - TZ=$TZ
      - MAX_WORKERS=1
      - WEB_CONCURRENCY=1
      - BASE_URL=https://mealie.$DOMAINNAME
    restart: unless-stopped
    labels:
      - "diun.enable=true"
@di5cord20 di5cord20 added bug Something isn't working triage labels Feb 24, 2024
@michael-genson
Copy link
Collaborator

Can you share your backup file? Based on that snippet of logs it looks like it's related to this:
#3171

Did you delete a user at some point?

@di5cord20
Copy link
Author

di5cord20 commented Feb 24, 2024

I don't recall deleting a user.
But I think I understand the issue now. I'm going to update the "userId": "00cbcd4d-3527-4357-85a9-627d439a5168" to my current user ID value on the v1.0.0beta-5 instance, take a backup, and then restore on v1.2.0

I'll post back after to confirm it that resolved the problem.

@michael-genson
Copy link
Collaborator

Yup, that should fix it. I confirmed on my end using your backup

The only other data is there's a cookbook with two invalid category ids. That won't prevent the cookbook from restoring, but those categories will be missing (since they don't exist). Most likely they were missing pre-backup anyway since they don't exist, so it shouldn't be an issue

@di5cord20
Copy link
Author

Confirmed - after manually updating every recipe to the current userId, all my recipes imported properly.

Really appreciate your help @michael-genson .

I'm sure it's been suggested before, to avoid similar issues in the use case where the userId doesn't exist on import, perhaps defaulting to current admin userId (or providing an option) would be a good feature to have. It wasn't too bad in my case to manually update my recipes, but I can imagine much more challenging for anyone with a much larger catalogue.

@michael-genson
Copy link
Collaborator

Glad to hear!

perhaps defaulting to current admin userId

Yup I think this is a great idea, I'll add a separate ticket for it related to #3171

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

2 participants