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.19k stars 724 forks source link

[BUG] - Can't Upgrade from beta5 -> RC #2769

Closed michael-genson closed 10 months ago

michael-genson commented 11 months ago

First Check

What is the issue you are experiencing?

A user reported in Discord that they were unable to upgrade from beta5 to RC2 with the reported error:

psycopg2.errors.UndefinedColumn: column users.auth_method does not exist

I had the user first upgrade to omni-nightly, then upgrade to RC2, and they reported it was successful. The error is similar to the one I fixed in https://github.com/mealie-recipes/mealie/pull/2760: I suspect alembic is calling a query on the user model at some point, which automatically tries to select the auth_method column (which doesn't exist yet due to a pending migration), and fails. More investigation is needed. Assuming I'm right, the solution is to lazy load columns (see https://github.com/mealie-recipes/mealie/pull/2760).

Until this is fixed, a quick workaround is to first upgrade to omni nightly, then upgrade to whichever version you're trying to target (in this case: RC2).

Steps to Reproduce

1) Have a beta5 instance 2) Try to migrate directly to RC2

Please provide relevant logs

psycopg2.errors.UndefinedColumn: column users.auth_method does not exist

Mealie Version

beta 5 -> RCx

Deployment

Docker (Linux)

Additional Deployment Details

No response

WesleyKlop commented 11 months ago

Hey! I have the same issue but I was not able to fix it by using the nightly tagged image.

During pod startup during the running of migrations I see an excpetion. After this the container correctly starts but I cannot login (observing the error message in this issue)

startup log until SYSTEM STARTUP

```text INFO: 29-Nov-23 15:19:43 Database connection established. INFO: 29-Nov-23 15:19:43 Context impl PostgresqlImpl. INFO: 29-Nov-23 15:19:43 Will assume transactional DDL. INFO: 29-Nov-23 15:19:43 Migration needed. Performing migration... INFO: 29-Nov-23 15:19:43 Context impl PostgresqlImpl. INFO: 29-Nov-23 15:19:43 Will assume transactional DDL. INFO: 29-Nov-23 15:19:43 Running upgrade 44e8d670719d -> 2ea7a807915c, add recipe_timeline_events table INFO: 29-Nov-23 15:19:43 Running upgrade 2ea7a807915c -> 1923519381ad, added recipe last made timestamp INFO: 29-Nov-23 15:19:43 Running upgrade 1923519381ad -> 167eb69066ad, add recipe_scale to shopping list item ref INFO: 29-Nov-23 15:19:43 Running upgrade 167eb69066ad -> 165d943c64ee, add related user to mealplan INFO: 29-Nov-23 15:19:43 Running upgrade 165d943c64ee -> ff5f73b01a7a, add missing foreign key and order indices INFO: 29-Nov-23 15:19:45 Running upgrade ff5f73b01a7a -> 16160bf731a0, add more indices necessary for search INFO: 29-Nov-23 15:19:45 Running upgrade 16160bf731a0 -> 5ab195a474eb, add normalized search properties INFO: 29-Nov-23 15:19:45 Running upgrade 5ab195a474eb -> b04a08da2108, added shopping list label settings INFO: 29-Nov-23 15:19:46 Running upgrade b04a08da2108 -> 38514b39a824, add auth_method to user table INFO: 29-Nov-23 15:19:46 Running upgrade 38514b39a824 -> b3dbb554ba53, postgres fuzzy search INFO: 29-Nov-23 15:19:46 Running upgrade b3dbb554ba53 -> 04ac51cbe9a4, added group slug INFO: 29-Nov-23 15:19:46 Running upgrade 04ac51cbe9a4 -> 1825b5225403, added recipe note to shopping list recipe ref INFO: 29-Nov-23 15:19:46 Running upgrade 1825b5225403 -> bcfdad6b7355, remove tool name and slug unique contraints INFO: 29-Nov-23 15:19:46 Running upgrade bcfdad6b7355 -> 0341b154f79a, added normalized unit and food names INFO: 29-Nov-23 15:19:46 Running upgrade 0341b154f79a -> dded3119c1fe, added unique constraints Traceback (most recent call last): File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1965, in _exec_single_context self.dialect.do_execute( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 921, in do_execute cursor.execute(statement, parameters) psycopg2.errors.UndefinedColumn: column ingredient_foods.plural_name does not exist LINE 1: ..., ingredient_foods.name AS ingredient_foods_name, ingredient... ^ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/app/mealie/db/init_db.py", line 110, in main() File "/app/mealie/db/init_db.py", line 93, in main command.upgrade(alembic_cfg, "head") File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/command.py", line 382, in upgrade script.run_env() File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/script/base.py", line 578, in run_env util.load_python_file(self.dir, "env.py") File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/util/pyfiles.py", line 93, in load_python_file module = load_module_py(module_id, path) File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/util/pyfiles.py", line 109, in load_module_py spec.loader.exec_module(module) # type: ignore File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/app/alembic/env.py", line 77, in run_migrations_online() File "/app/alembic/env.py", line 71, in run_migrations_online context.run_migrations() File "", line 8, in run_migrations File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/runtime/environment.py", line 922, in run_migrations self.get_context().run_migrations(**kw) File "/opt/pysetup/.venv/lib/python3.10/site-packages/alembic/runtime/migration.py", line 624, in run_migrations step.migration_fn(**kw) File "/app/alembic/versions/2023-10-04-14.29.26_dded3119c1fe_added_unique_constraints.py", line 178, in upgrade _resolve_duplicate_foods_units_labels() File "/app/alembic/versions/2023-10-04-14.29.26_dded3119c1fe_added_unique_constraints.py", line 143, in _resolve_duplicate_foods_units_labels resolve_func(session, keep_obj, keep_id, dupe_id) File "/app/alembic/versions/2023-10-04-14.29.26_dded3119c1fe_added_unique_constraints.py", line 76, in _resolve_duplicate_food session.commit() File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1920, in commit trans.commit(_to_root=True) File "", line 2, in commit File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go ret_value = fn(self, *arg, **kw) File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1236, in commit self._prepare_impl() File "", line 2, in _prepare_impl File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go ret_value = fn(self, *arg, **kw) File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1211, in _prepare_impl self.session.flush() File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4163, in flush self._flush(objects) File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4298, in _flush with util.safe_reraise(): File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py", line 147, in __exit__ raise exc_value.with_traceback(exc_tb) File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4259, in _flush flush_context.execute() File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute rec.execute(self) File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/unitofwork.py", line 591, in execute self.dependency_processor.process_saves(uow, states) File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/dependency.py", line 815, in process_saves self._synchronize( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/dependency.py", line 855, in _synchronize sync.populate( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/sync.py", line 38, in populate value = source.manager[prop.key].impl.get( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/attributes.py", line 1085, in get value = self._fire_loader_callables(state, key, passive) File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/attributes.py", line 1115, in _fire_loader_callables return state._load_expired(state, passive) File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/state.py", line 798, in _load_expired self.manager.expired_attribute_loader(self, toload, passive) File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/loading.py", line 1617, in load_scalar_attributes result = load_on_ident( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/loading.py", line 481, in load_on_ident return load_on_pk_identity( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/loading.py", line 666, in load_on_pk_identity session.execute( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2246, in execute return self._execute_internal( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2141, in _execute_internal result: Result[Any] = compile_state_cls.orm_execute_statement( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/context.py", line 293, in orm_execute_statement result = conn.execute( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1412, in execute return meth( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 483, in _execute_on_connection return connection._execute_clauseelement( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1635, in _execute_clauseelement ret = self._execute_context( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1844, in _execute_context return self._exec_single_context( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1984, in _exec_single_context self._handle_dbapi_exception( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2339, 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 1965, in _exec_single_context self.dialect.do_execute( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 921, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column ingredient_foods.plural_name does not exist LINE 1: ..., ingredient_foods.name AS ingredient_foods_name, ingredient... ^ [SQL: SELECT ingredient_foods.id AS ingredient_foods_id, ingredient_foods.group_id AS ingredient_foods_group_id, ingredient_foods.name AS ingredient_foods_name, ingredient_foods.plural_name AS ingredient_foods_plural_name, ingredient_foods.description AS ingredient_foods_description, ingredient_foods.label_id AS ingredient_foods_label_id, ingredient_foods.name_normalized AS ingredient_foods_name_normalized, ingredient_foods.plural_name_normalized AS ingredient_foods_plural_name_normalized, ingredient_foods.created_at AS ingredient_foods_created_at, ingredient_foods.update_at AS ingredient_foods_update_at FROM ingredient_foods WHERE ingredient_foods.id = %(pk_1)s::UUID] [parameters: {'pk_1': '35119c2f-f846-43b1-a782-57351e99e3b0'}] (Background on this error at: https://sqlalche.me/e/20/f405) INFO: Started server process [15] INFO: Waiting for application startup. ```

Settings

```json { "theme": { "light_primary": "#E58325", "light_accent": "#007A99", "light_secondary": "#973542", "light_success": "#43A047", "light_info": "#1976D2", "light_warning": "#FF6D00", "light_error": "#EF5350", "dark_primary": "#E58325", "dark_accent": "#007A99", "dark_secondary": "#973542", "dark_success": "#43A047", "dark_info": "#1976D2", "dark_warning": "#FF6D00", "dark_error": "#EF5350" }, "PRODUCTION": true, "BASE_URL": "https://redacted.redacted.baseurl", "STATIC_FILES": "/spa/static", "IS_DEMO": false, "API_PORT": 9000, "API_DOCS": true, "TOKEN_TIME": 48, "LOG_LEVEL": "INFO", "GIT_COMMIT_HASH": "5ee077e09faf5408af64e5afcb93a4961a7bc37d", "ALLOW_SIGNUP": true, "SECURITY_MAX_LOGIN_ATTEMPTS": 5, "SECURITY_USER_LOCKOUT_TIME": 24, "DB_ENGINE": "postgres", "DEFAULT_GROUP": "Home", "SMTP_HOST": null, "SMTP_PORT": "587", "SMTP_FROM_NAME": "Mealie", "SMTP_FROM_EMAIL": null, "SMTP_AUTH_STRATEGY": "TLS", "LDAP_AUTH_ENABLED": false, "LDAP_SERVER_URL": null, "LDAP_TLS_INSECURE": false, "LDAP_TLS_CACERTFILE": null, "LDAP_ENABLE_STARTTLS": false, "LDAP_BASE_DN": null, "LDAP_QUERY_BIND": null, "LDAP_QUERY_PASSWORD": null, "LDAP_USER_FILTER": null, "LDAP_ADMIN_FILTER": null, "LDAP_ID_ATTRIBUTE": "uid", "LDAP_MAIL_ATTRIBUTE": "mail", "LDAP_NAME_ATTRIBUTE": "name", "TESTING": false } ```

POST /api/auth/token exception

```text INFO: 10.244.0.29:57512 - "POST /api/auth/token HTTP/1.1" 500 Internal Server Error ERROR: Exception in ASGI application Traceback (most recent call last): File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1965, in _exec_single_context self.dialect.do_execute( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 921, in do_execute cursor.execute(statement, parameters) psycopg2.errors.UndefinedColumn: column users.auth_method does not exist LINE 1: ...ame, users.username, users.email, users.password, users.auth... ^ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/opt/pysetup/.venv/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 436, in run_asgi result = await app( # type: ignore[func-returns-value] File "/opt/pysetup/.venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__ return await self.app(scope, receive, send) File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/applications.py", line 1106, in __call__ await super().__call__(scope, receive, send) File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/applications.py", line 122, in __call__ await self.middleware_stack(scope, receive, send) File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__ raise exc File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__ await self.app(scope, receive, _send) File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 24, in __call__ await responder(scope, receive, send) File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 44, in __call__ await self.app(scope, receive, self.send_with_gzip) File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__ raise exc File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__ await self.app(scope, receive, sender) File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__ raise e File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__ await self.app(scope, receive, send) File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 718, in __call__ await route.handle(scope, receive, send) File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle await self.app(scope, receive, send) File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 66, in app response = await func(request) File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 274, in app raw_response = await run_endpoint_function( File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 193, in run_endpoint_function return await run_in_threadpool(dependant.call, **values) File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/concurrency.py", line 41, in run_in_threadpool return await anyio.to_thread.run_sync(func, *args) File "/opt/pysetup/.venv/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/opt/pysetup/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "/opt/pysetup/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run result = context.run(func, *args) File "/app/mealie/routes/auth/auth.py", line 73, in get_token user = authenticate_user(session, email, password) # type: ignore File "/app/mealie/core/security/security.py", line 51, in authenticate_user user = db.users.get_one(email, "email", any_case=True) File "/app/mealie/repos/repository_generic.py", line 159, in get_one result = self.session.execute(q).unique().scalars().one_or_none() File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2246, in execute return self._execute_internal( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2141, in _execute_internal result: Result[Any] = compile_state_cls.orm_execute_statement( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/context.py", line 293, in orm_execute_statement result = conn.execute( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1412, in execute return meth( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 483, in _execute_on_connection return connection._execute_clauseelement( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1635, in _execute_clauseelement ret = self._execute_context( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1844, in _execute_context return self._exec_single_context( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1984, in _exec_single_context self._handle_dbapi_exception( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2339, 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 1965, in _exec_single_context self.dialect.do_execute( File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 921, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column users.auth_method does not exist LINE 1: ...ame, users.username, users.email, users.password, users.auth... ^ [SQL: SELECT users.id, users.full_name, users.username, users.email, users.password, users.auth_method, users.admin, users.advanced, users.group_id, users.cache_key, users.login_attemps, users.locked_at, users.can_manage, users.can_invite, users.can_organize, users.owned_recipes_id, users.created_at, users.update_at, groups_1.id AS id_1, groups_1.name, groups_1.slug, groups_1.created_at AS created_at_1, groups_1.update_at AS update_at_1, long_live_tokens_1.name AS name_1, long_live_tokens_1.token, long_live_tokens_1.user_id, long_live_tokens_1.id AS id_2, long_live_tokens_1.created_at AS created_at_2, long_live_tokens_1.update_at AS update_at_2 FROM users LEFT OUTER JOIN groups AS groups_1 ON groups_1.id = users.group_id LEFT OUTER JOIN long_live_tokens AS long_live_tokens_1 ON users.id = long_live_tokens_1.user_id WHERE lower(users.email) = %(lower_1)s] [parameters: {'lower_1': 'myemailaddressthat@iuseformealie.fake'}] (Background on this error at: https://sqlalche.me/e/20/f405) ```

My full deployment config is here: https://github.com/WesleyKlop/infrastructure/tree/main/apps/mealie/javelin https://github.com/WesleyKlop/infrastructure/tree/main/apps/mealie/base

michael-genson commented 11 months ago

Hey! I have the same issue but I was not able to fix it by using the nightly tagged image.

This is a different issue, just opened a PR for it - https://github.com/mealie-recipes/mealie/pull/2773

michael-genson commented 10 months ago

I can't reproduce this anymore since #2773 so I'm going to say it's resolved until someone else says otherwise. https://github.com/mealie-recipes/mealie/pull/2795 also added better logs for backups which should help

spieker commented 9 months ago

@michael-genson I have just updated from 0.5.x to 1.1.0, and I do have the same issues. Here are the logs I get on the console:

INFO:     62.214.6.66:0 - "POST /api/auth/token HTTP/1.0" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1965, in _exec_single_context
    self.dialect.do_execute(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 921, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.UndefinedColumn: column long_live_tokens_1.user_id does not exist
LINE 2: ...g_live_tokens AS long_live_tokens_1 ON users.id = long_live_...
                                                             ^

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

Traceback (most recent call last):
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 419, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
    return await self.app(scope, receive, send)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 24, in __call__
    await responder(scope, receive, send)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 44, in __call__
    await self.app(scope, receive, self.send_with_gzip)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 762, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 782, in app
    await route.handle(scope, receive, send)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 297, in handle
    await self.app(scope, receive, send)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 77, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 72, in app
    response = await func(request)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 299, in app
    raise e
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 294, in app
    raw_response = await run_endpoint_function(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 193, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/concurrency.py", line 40, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/app/mealie/routes/auth/auth.py", line 74, in get_token
    user = authenticate_user(session, email, password)  # type: ignore
  File "/app/mealie/core/security/security.py", line 51, in authenticate_user
    user = db.users.get_one(email, "email", any_case=True)
  File "/app/mealie/repos/repository_generic.py", line 159, in get_one
    result = self.session.execute(q).unique().scalars().one_or_none()
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2246, in execute
    return self._execute_internal(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2141, in _execute_internal
    result: Result[Any] = compile_state_cls.orm_execute_statement(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/orm/context.py", line 293, in orm_execute_statement
    result = conn.execute(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1412, in execute
    return meth(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 483, in _execute_on_connection
    return connection._execute_clauseelement(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1635, in _execute_clauseelement
    ret = self._execute_context(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1844, in _execute_context
    return self._exec_single_context(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1984, in _exec_single_context
    self._handle_dbapi_exception(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2339, 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 1965, in _exec_single_context
    self.dialect.do_execute(
  File "/opt/pysetup/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 921, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column long_live_tokens_1.user_id does not exist
LINE 2: ...g_live_tokens AS long_live_tokens_1 ON users.id = long_live_...
                                                             ^

[SQL: SELECT users.id, users.full_name, users.username, users.email, users.password, users.auth_method, users.admin, users.advanced, users.group_id, users.cache_key, users.login_attemps, users.locked_at, users.can_manage, users.can_invite, users.can_organize, users.owned_recipes_id, users.created_at, users.update_at, groups_1.id AS id_1, groups_1.name, groups_1.slug, groups_1.created_at AS created_at_1, groups_1.update_at AS update_at_1, long_live_tokens_1.name AS name_1, long_live_tokens_1.token, long_live_tokens_1.user_id, long_live_tokens_1.id AS id_2, long_live_tokens_1.created_at AS created_at_2, long_live_tokens_1.update_at AS update_at_2
FROM users LEFT OUTER JOIN groups AS groups_1 ON groups_1.id = users.group_id LEFT OUTER JOIN long_live_tokens AS long_live_tokens_1 ON users.id = long_live_tokens_1.user_id
WHERE lower(users.email) = %(lower_1)s]
[parameters: {'lower_1': '****'}]
(Background on this error at: https://sqlalche.me/e/20/f405)

It would be great to have a fix for it, so I can use my recipes again. Is there maybe some SQL query / migration I can run manually?

Thanks a lot!

Kuchenpirat commented 9 months ago

hey this would be a different issue all together, as beta5 and v0.5.6 do not have much in common.

Did you follow the migration guide? https://nightly.mealie.io/documentation/getting-started/migrating-to-mealie-v1/

If you did, please open a seperate issue

spieker commented 9 months ago

Thank you for the quick response! I'll follow the instructions now.