alexbelgium / hassio-addons

My homeassistant addons
MIT License
1.56k stars 223 forks source link

πŸ› [Mealie] Not able to restore backup from standalone Mealie 12.2.0 #1585

Closed phellarv closed 1 month ago

phellarv commented 1 month ago

Description

I am trying to migrate from a standalon Mealie 12.2.0, and do a normal backup on the standalone, which I would like to use for migrating. I upload the backup to the addon, and try to restore it. The restore fails, and I after trying to log out, and in again. both the default login, the newly created login (both expected) and the old login from the backup does not work.

PS! It's a completely fresh install of the addon, and not an upgraded one.

Reproduction steps

1. Go to settings->backup on the standalone site and create a backup
2. Download backup
3. Go to settings->backup on the addon site and upload backup
4. See error

Addon Logs

INFO     2024-09-25T10:46:52 - Running upgrade 1923519381ad -> 167eb69066ad, add recipe_scale to shopping list item ref
INFO     2024-09-25T10:46:52 - Running upgrade 167eb69066ad -> 165d943c64ee, add related user to mealplan
INFO     2024-09-25T10:46:52 - Running upgrade 165d943c64ee -> ff5f73b01a7a, add missing foreign key and order indices
INFO     2024-09-25T10:46:52 - Running upgrade ff5f73b01a7a -> 16160bf731a0, add more indices necessary for search
INFO     2024-09-25T10:46:52 - Running upgrade 16160bf731a0 -> 5ab195a474eb, add normalized search properties
INFO     2024-09-25T10:46:52 - Running upgrade 5ab195a474eb -> b04a08da2108, added shopping list label settings
INFO     2024-09-25T10:46:52 - Running upgrade b04a08da2108 -> 38514b39a824, add auth_method to user table
INFO     2024-09-25T10:46:52 - Running upgrade 38514b39a824 -> b3dbb554ba53, postgres fuzzy search
INFO     2024-09-25T10:46:53 - Running upgrade b3dbb554ba53 -> 04ac51cbe9a4, added group slug
INFO     2024-09-25T10:46:53 - Running upgrade 04ac51cbe9a4 -> 1825b5225403, added recipe note to shopping list recipe ref
INFO     2024-09-25T10:46:53 - Running upgrade 1825b5225403 -> bcfdad6b7355, remove tool name and slug unique contraints
INFO     2024-09-25T10:46:53 - Running upgrade bcfdad6b7355 -> 0341b154f79a, added normalized unit and food names
INFO     2024-09-25T10:46:53 - Running upgrade 0341b154f79a -> dded3119c1fe, added unique constraints
INFO     2024-09-25T10:46:53 - Running upgrade dded3119c1fe -> ba1e4a6cfe99, added plural names and alias tables for foods and units
INFO     2024-09-25T10:46:53 - Running upgrade ba1e4a6cfe99 -> 2298bb460ffd, added user to shopping list
INFO     2024-09-25T10:46:53 - Running upgrade 2298bb460ffd -> 09aba125b57a, add OIDC auth method
INFO     2024-09-25T10:46:53 - Running upgrade 09aba125b57a -> d7c6efd2de42, migrate favorites and ratings to user_ratings
INFO     2024-09-25T10:46:53 - Running upgrade d7c6efd2de42 -> 7788478a0338, add group recipe actions
INFO     2024-09-25T10:46:53 - Running upgrade 7788478a0338 -> 32d69327997b, Add staple flag to foods
WARNING  2024-09-25T10:46:53 - Removing row from table group_meal_plans because of invalid foreign key recipe_id: ef40caad98b442838f0be8559f0c36d5
WARNING  2024-09-25T10:46:53 - Removing row from table group_meal_plans because of invalid foreign key recipe_id: ef40caad98b442838f0be8559f0c36d5
WARNING  2024-09-25T10:46:53 - Row: {'id': 1, 'created_at': datetime.datetime(2023, 3, 28, 22, 17, 3, 529121), 'update_at': datetime.datetime(2023, 3, 28, 22, 17, 3, 529126), 'date': datetime.date(2023, 3, 27), 'entry_type': 'dinner', 'title': '', 'text': '', 'group_id': '11c2827f42ff46c882df95e6c1c58e57', 'recipe_id': 'ef40caad98b442838f0be8559f0c36d5', 'user_id': None}
WARNING  2024-09-25T10:46:53 - Row: {'id': 1, 'created_at': datetime.datetime(2023, 3, 28, 22, 17, 3, 529121), 'update_at': datetime.datetime(2023, 3, 28, 22, 17, 3, 529126), 'date': datetime.date(2023, 3, 27), 'entry_type': 'dinner', 'title': '', 'text': '', 'group_id': '11c2827f42ff46c882df95e6c1c58e57', 'recipe_id': 'ef40caad98b442838f0be8559f0c36d5', 'user_id': None}
ERROR    2024-09-25T10:46:53 - (sqlite3.IntegrityError) NOT NULL constraint failed: group_meal_plans.date
[SQL: INSERT INTO group_meal_plans DEFAULT VALUES]
(Background on this error at: https://sqlalche.me/e/20/gkpj)
Traceback (most recent call last):
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute
ERROR    2024-09-25T10:46:53 - (sqlite3.IntegrityError) NOT NULL constraint failed: group_meal_plans.date
    cursor.execute(statement, parameters)
[SQL: INSERT INTO group_meal_plans DEFAULT VALUES]
(Background on this error at: https://sqlalche.me/e/20/gkpj)
Traceback (most recent call last):
sqlite3.IntegrityError: NOT NULL constraint failed: group_meal_plans.date
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/mealie/routes/admin/admin_backups.py", line 105, in import_one
    backup.restore(file)
  File "/app/mealie/services/backups_v2/backup_v2.py", line 101, in restore
    self.dialect.do_execute(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute
    cursor.execute(statement, parameters)
sqlite3.IntegrityError: NOT NULL constraint failed: group_meal_plans.date

The above exception was the direct cause of the following exception:

    self.db_exporter.restore(database_json)
  File "/app/mealie/services/backups_v2/alchemy_exporter.py", line 179, in restore
Traceback (most recent call last):
    connection.execute(insert(table), rows)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1418, in execute
  File "/app/mealie/routes/admin/admin_backups.py", line 105, in import_one
    return meth(
    backup.restore(file)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection
  File "/app/mealie/services/backups_v2/backup_v2.py", line 101, in restore
    return connection._execute_clauseelement(
    self.db_exporter.restore(database_json)
  File "/app/mealie/services/backups_v2/alchemy_exporter.py", line 179, in restore
    connection.execute(insert(table), rows)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1418, in execute
    return meth(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection
    return connection._execute_clauseelement(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement
    ret = self._execute_context(
    ret = self._execute_context(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
    return self._exec_single_context(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
    self._handle_dbapi_exception(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
    return self._exec_single_context(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
    self._handle_dbapi_exception(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) NOT NULL constraint failed: group_meal_plans.date
[SQL: INSERT INTO group_meal_plans DEFAULT VALUES]
(Background on this error at: https://sqlalche.me/e/20/gkpj)
    self.dialect.do_execute(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) NOT NULL constraint failed: group_meal_plans.date
[SQL: INSERT INTO group_meal_plans DEFAULT VALUES]
(Background on this error at: https://sqlalche.me/e/20/gkpj)
INFO     2024-09-25T10:46:53 - [10.1.30.10:0] 500 Internal Server Error "POST /api/admin/backups/mealie_2024.09.25.08.40.19.zip/restore HTTP/1.1"
[25/Sep/2024:10:46:53 +0200] 500 -(10.1.30.10) POST /api/admin/backups/mealie_2024.09.25.08.40.19.zip/restore HTTP/1.1 (Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0)

Architecture

amd64

OS

HAos

phellarv commented 1 month ago

When I try to log out, and in again, I get this:

INFO     2024-09-25T10:51:21 - [10.1.30.10:0] 401 Unauthorized "POST /api/auth/token HTTP/1.1"
[25/Sep/2024:10:51:21 +0200] 401 -(10.1.30.10) POST /api/auth/token HTTP/1.1 (Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0)
ERROR    2024-09-25T10:51:27 - Incorrect username or password from 10.1.30.10
ERROR    2024-09-25T10:51:27 - Incorrect username or password from 10.1.30.10
INFO     2024-09-25T10:51:27 - [10.1.30.10:0] 401 Unauthorized "POST /api/auth/token HTTP/1.1"
[25/Sep/2024:10:51:27 +0200] 401 -(10.1.30.10) POST /api/auth/token HTTP/1.1 (Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0)

When I try default, old, and new details. None of the works.

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.