Skip to content

fix(setup): add idempotent upgrade for missing content_type.icon and dashboard.customizable#16907

Open
Ibochkarev wants to merge 1 commit intomodxcms:3.xfrom
Ibochkarev:fix/15504-missing-columns
Open

fix(setup): add idempotent upgrade for missing content_type.icon and dashboard.customizable#16907
Ibochkarev wants to merge 1 commit intomodxcms:3.xfrom
Ibochkarev:fix/15504-missing-columns

Conversation

@Ibochkarev
Copy link
Collaborator

What does it do?

Adds an idempotent upgrade script for Revolution 3.2.1-pl that ensures the content_type.icon and dashboard.customizable columns exist. Before adding each column it runs SHOW COLUMNS ... LIKE; only if the column is missing it calls $modx->manager->addField(). This repairs installations where the 3.0.0-pl migrations did not run or only partially completed (e.g. upgrade was interrupted or files were replaced without running setup).

  • setup/includes/upgrades/common/3.2.1-missing-columns.php — shared logic: check and add icon on content_type, then customizable on dashboard.
  • setup/includes/upgrades/mysql/3.2.1-pl.php — MySQL upgrade entry that includes the common script.

Why is it needed?

After upgrading to 3.x, some installations hit 500 errors and an empty web context because the database is missing the icon and customizable columns that the application expects. The 3.0.0-pl upgrade adds them, but if that upgrade never ran or failed partway (while settings_version was already updated), re-running the installer does not re-apply 3.0.0-pl. A new 3.2.1-pl script that runs for all versions < 3.2.1-pl and adds the columns only when missing fixes those broken upgrades.

How to test

  1. Start from a MODX 2.x or early 3.x database that does not have content_type.icon or dashboard.customizable (e.g. restore a backup or manually drop those columns).
  2. Set settings_version to a value < 3.2.1-pl (e.g. 3.0.0-pl).
  3. Run the Revolution setup in upgrade mode (upgrade to current version).
  4. Confirm the upgrade log shows the add-column steps for icon and/or customizable when missing.
  5. Confirm the manager and front-end load without 500 errors and the resource tree shows the web context.

Optional: Run the upgrade again; the script should do nothing (no duplicate column errors) because the columns already exist.

Related issue(s)/PR(s)

Resolves #15504

…dashboard.customizable

Add 3.2.1-pl upgrade script that checks for and adds missing columns when
upgrading from broken or partial 3.0.0 upgrades. Fixes 500 errors and
empty web context (Unknown column modContentType.icon / modDashboard.customizable).

Resolves modxcms#15504
@Ibochkarev Ibochkarev marked this pull request as ready for review February 26, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

500 errors and empty web context after update - Unknown column modContentType.icon in field list

1 participant