Bug description
Downgrading the application code from 2.59.0 to 2.58.x against a database already migrated to 2.59 leaves the schema and code out of sync, with no guard or clear error. The 2.59 migration removes the Credential Manager (drops dojo_cred_user/dojo_cred_mapping and the dojo_system_settings.enable_credentials column), but 2.58 code still expects them.
This produces two failures:
- The initializer crashes during pghistory trigger configuration because 2.58 still registers
Cred_User with pghistory:
Configuring pghistory triggers
File "/app/dojo/management/commands/complete_initialization.py", line 36, in handle
configure_pghistory_triggers()
File "/app/dojo/auditlog/services.py", line 467, in configure_pghistory_triggers
call_command("pgtrigger", "enable")
psycopg.errors.UndefinedTable: relation "dojo_cred_user" does not exist
django.db.utils.ProgrammingError: relation "dojo_cred_user" does not exist
- Even once the app starts, a runtime banner appears on multiple pages because the code queries a column the 2.59 schema removed:
"Warning: Unable to load system settings from database: column dojo_system_settings.enable_credentials does not exist LINE 1: ...ings"."risk_acceptance_notify_before_expiration", "dojo_syst... ^. Default values are being used. Please check your database configuration and run migrations if needed."
Steps to reproduce
- Run DefectDojo 2.59.0 so the database is migrated to 2.59 (Credential Manager removed).
- Move the code back to 2.58.x against the same database (e.g., a
docker compose pull/checkout landing on the older tag), then rebuild.
- Run
docker compose up -d and watch docker compose logs -f initializer.
- See the initializer exit 1 on the pghistory step; if the app is forced up, see the
enable_credentials banner on pages that read system settings.
Expected behavior
A downgrade against a newer schema should be detected and blocked with a clear message identifying a code/database version mismatch. At minimum the initializer error and the system-settings banner should point to the version mismatch as the cause.
Deployment method (select with an X)
Environment information
- Operating System: Ubuntu 24.04.04
- Docker Compose
- DefectDojo version: downgraded from 2.59.0 to 2.58.4 (database at 2.59)
Additional context
Root cause was a downgrade, not data corruption. Recreating dojo_cred_user let 2.58 start but left the enable_credentials banner; the actual fix was recreating the missing table from the Credential Manager schema. Filing because the failure modes give no indication that a version/schema mismatch is the cause.

Bug description
Downgrading the application code from 2.59.0 to 2.58.x against a database already migrated to 2.59 leaves the schema and code out of sync, with no guard or clear error. The 2.59 migration removes the Credential Manager (drops
dojo_cred_user/dojo_cred_mappingand thedojo_system_settings.enable_credentialscolumn), but 2.58 code still expects them.This produces two failures:
Cred_Userwith pghistory:Configuring pghistory triggers
File "/app/dojo/management/commands/complete_initialization.py", line 36, in handle
configure_pghistory_triggers()
File "/app/dojo/auditlog/services.py", line 467, in configure_pghistory_triggers
call_command("pgtrigger", "enable")
psycopg.errors.UndefinedTable: relation "dojo_cred_user" does not exist
django.db.utils.ProgrammingError: relation "dojo_cred_user" does not exist
"Warning: Unable to load system settings from database: column dojo_system_settings.enable_credentials does not exist LINE 1: ...ings"."risk_acceptance_notify_before_expiration", "dojo_syst... ^. Default values are being used. Please check your database configuration and run migrations if needed."
Steps to reproduce
docker compose pull/checkout landing on the older tag), then rebuild.docker compose up -dand watchdocker compose logs -f initializer.enable_credentialsbanner on pages that read system settings.Expected behavior
A downgrade against a newer schema should be detected and blocked with a clear message identifying a code/database version mismatch. At minimum the initializer error and the system-settings banner should point to the version mismatch as the cause.
Deployment method (select with an
X)Environment information
Additional context
Root cause was a downgrade, not data corruption. Recreating
dojo_cred_userlet 2.58 start but left theenable_credentialsbanner; the actual fix was recreating the missing table from the Credential Manager schema. Filing because the failure modes give no indication that a version/schema mismatch is the cause.