From b1e44f5d6bf4721c2e717593880aa9cdeda6e665 Mon Sep 17 00:00:00 2001 From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Fri, 8 May 2026 13:37:10 -0700 Subject: [PATCH] Tweakhancment: Include the last applied 'documents' migration in the log (#12757) --- src/paperless/checks.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/paperless/checks.py b/src/paperless/checks.py index 4d8646112..6cc646f6b 100644 --- a/src/paperless/checks.py +++ b/src/paperless/checks.py @@ -1,3 +1,4 @@ +import logging import os import shutil import stat @@ -239,12 +240,21 @@ def check_v3_minimum_upgrade_version( except (DatabaseError, OperationalError): return [] + logger = logging.getLogger(__name__) + last_applied = sorted(applied)[-1] if applied else "(none)" + logger.error( + "V3 upgrade check failed: last applied documents migration is %r. " + "Expected '1075_workflowaction_order' (v2.20.15). " + "Ensure you have upgraded to v2.20.15 and run 'manage.py migrate' before upgrading to v3.", + last_applied, + ) + return [ Error( "Cannot upgrade to Paperless-ngx v3 from this version.", hint=( - "Upgrading to v3 can only be performed from v2.20.15." - "Please upgrade to v2.20.15, run migrations, then upgrade to v3." + "Upgrading to v3 can only be performed from v2.20.15. " + "Please upgrade to v2.20.15, run migrations, then upgrade to v3. " "See https://docs.paperless-ngx.com/setup/#upgrading for details." ), id="paperless.E002",