Repository navigation
bug: Guard intropage height/shared column upgrades against duplicates - #475
Merged
Merged
Conversation
The 4.0.2 'shared' and 4.0.5 'height' upgrade steps ran unguarded ALTER TABLE ... ADD COLUMN statements. Because those same columns are also declared in intropage_initialize_database()'s schema, which api_plugin_db_table_create() auto-adds to existing tables, the column can already exist when the upgrade step runs, producing repeated 'Duplicate column name' DB errors on console pages. Wrap both ALTERs in db_column_exists() checks so the steps are idempotent, matching the pattern already used by the surrounding upgrade blocks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the column-existence guards added to the database upgrade steps.
No open issues 🎉
What changed in this PR
This PR prevents duplicate-column errors during Intropage database upgrades by checking whether columns already exist before adding them. Clean-install schemas remain unchanged.
Changes:
- Guard the dashboard
sharedcolumn addition withdb_column_exists(). - Guard both panel
heightcolumn additions, matching neighboring upgrade steps.
| File | Description |
|---|---|
includes/database.php |
Adds existence checks to make the shared and height upgrade steps safe to repeat. |
Review effort: Balanced
somethingwithproof
approved these changes
Nov 11, 2026
somethingwithproof
left a comment
Member
There was a problem hiding this comment.
No blockers found. Both guards match the db_column_exists() pattern of the neighboring upgrade steps, and the remaining ADD COLUMN statements in intropage_upgrade_database() are already guarded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Problem
Applying the latest intropage logs repeated DB errors on console pages:
The backtrace points at
intropage_upgrade_database()inincludes/database.php.Root cause
The
height(4.0.5 block) andshared(4.0.2 block) columns are each created in two places that both run during an upgrade:intropage_initialize_database()declares them in the schema passed toapi_plugin_db_table_create(), which auto-adds any missing column to existing tables.intropage_upgrade_database()then runs a bare, unguardedALTER TABLE ... ADD COLUMN.Once the schema path has added the column, the
ALTERfails with Duplicate column name. Unlike the neighboring upgrade steps, these two were missing adb_column_exists()guard.Fix
Wrap both
ALTERs indb_column_exists()checks so the upgrade steps are idempotent, matching the pattern already used by the surrounding blocks. No schema or behavior change on clean installs.