Repository navigation
Description
Summary
We upgraded a copy of a web2project 2.3.1 database to 5.0.0-rc2 and hit four separate problems. The first one is the most serious, because a partly failed upgrade looks
complete.
Environment
- web2project 2.3.1 (
db_version33) to 5.0.0-rc2 - PHP 8.3.36, MySQL 8.4.13
- We ran
w2p_System_UpgradeManager::upgradeSystem()from a CLI script, not through the System Admin page.
1. db_version advances even when a migration fails
upgradeSystem() inserts the row into w2pversion after each migration, whether or not it had errors. With MySQL's default sql_mode, the run below returned 29 errors but
still ended at db_version 71 with code_version 5.0.0-rc2. The upgrade can't be re-run, because those migrations count as applied.
Suggested fix: stop at the first failing migration and don't record it as applied.
2. Migrations fail in MySQL's default strict mode
The README asks for MySQL 8, whose default sql_mode includes NO_ZERO_DATE and STRICT_TRANS_TABLES. Our old data and schema contain zero dates, and with the default mode we
got 29 errors, including:
035_tasklog_updates.sql: Invalid default value for 'task_log_created'
042_sequence_numbers.sql: Invalid default value for 'task_created'
045_task_path_enumeration.sql: Invalid default value for 'task_created'
046_config_deprecations.sql: Incorrect integer value: '' for column 'pref_user' at row 1
052_database_fixes.sql: Invalid default value for 'project_created'
Later errors follow from these, for example:
Unknown column 'task_path_enumeration' in 'field list'
Unknown column 'task_log_percent_complete' in 'field list'
Workaround: with sql_mode=NO_ENGINE_SUBSTITUTION, the same upgrade finished with only the errors in sections 3 and 4, plus one duplicate key error in 046 that may come
from our own data:
046_config_deprecations.sql: Duplicate entry '0-TASKSEXPANDED' for key 'user_preferences.PRIMARY'
Suggested fix: clean up zero dates before the migrations that depend on them, or have the installer check sql_mode and warn before it starts. The README could also mention
the requirement.
3. 070_align_upgraded_schema.sql fails on the value_charvalue index
Line 84 changes the column to TEXT while the index from the base schema still exists:
BLOB/TEXT column 'value_charvalue' used in key specification without a key length
The column stays VARCHAR(255), so long textarea custom field values may not fit.
Workaround that worked for us:
ALTER TABLE custom_fields_values
DROP INDEX value_charvalue,
MODIFY value_charvalue TEXT NULL DEFAULT NULL;We haven't tested this on a fresh install.
4. 071_hide_smartsearch_menu.sql doesn't run its UPDATE
_splitSQLUpdates() splits files with explode(';', $sql), and the comment in this file contains a semicolon ("This only hides the menu entry; access is still governed...").
The rest of the comment and the UPDATE then form one invalid statement:
You have an error in your SQL syntax ... near 'access is still governed by permissions, and an admin can show
-- it again from '
From reading the code, the UPDATE is never executed. We couldn't confirm the effect on our copy, because the value was already 0 there.
Suggested fix: remove the semicolon from the comment. It may also be worth making the splitter ignore comments, so this doesn't happen again.
Activity
Upgrades: run migrations before 056 without MySQL 8's strict date modes
Migration 046: merge default preferences stored as both '' and '0'
caseysoftware commentedon Nov 2, 2026
Thanks for the detailed report. All four problems are fixed on dev-5.0.0.
db_version advanced even when a migration failed. Fixed in 55b64319. The upgrader now stops at the first statement that fails and doesn’t record that migration, so the database stays at the last migration that finished. The install, upgrade and conversion pages report the migration, statement, line, MySQL error and sql_mode. After the problem is fixed, re-running carries on from that migration.
Migrations failed in MySQL 8’s default strict mode. Fixed in e8b84b56, 70cf04eb and 6834d6e0, building on 74bcbfc0 and b3e6b097.
035–055 (e8b84b5): these migrations were written for MySQL 5. The 1.x/2.x schemas give date columns a '0000-00-00 00:00:00' default, so under NO_ZERO_DATE any ALTER TABLE on those tables failed. The upgrader now runs migrations before 056 without the strict and zero-date flags for that session, which is what your NO_ENGINE_SUBSTITUTION workaround did, but only where it’s needed. 056 cleans the zero dates and rebuilds the tables, and from there on the server’s own mode applies. No README requirement is needed.
059 (70cf04e): files with a zero or missing upload date now get the upgrade time before file_date becomes NOT NULL.
046 (6834d6e): your duplicate '0-TASKSEXPANDED' was a default preference stored under both pref_user = '' and '0'. Older versions read both as user 0, so converting the column to INT made them collide. 046 now keeps the '0' row and drops its '' twin.
056 and 070 (74bcbfc, b3e6b09): these now clean zero dates and NULLs on older schemas before altering.
070’s value_charvalue index. Fixed in 74bcbfc. The indexes are dropped before the column becomes TEXT, as in your workaround.
071’s UPDATE never ran. Fixed in 74bcbfc. The statement splitter now ignores ; inside comments and quoted strings, so 071’s UPDATE runs, on fresh installs too.
Also fixed while testing on MySQL 8: fresh installs on MySQL 8 stopped at migration 004, because it declared a primary key column as NULL; that’s 3aeaa7c9. In a database created with MySQL 8’s default utf8mb4, they stopped even earlier, at 002, because an index was too long; that’s 04e62dab. Fresh installs now complete in either utf8 or utf8mb4 databases.
How it was tested: MySQL 8.0.46 with its default sql_mode, running upgradeSystem() from the command line as you did. The starting point was a database built from the 2.3.0 release’s own migrations (001–033) with zero-date data, a zero-dated file, and default preferences stored under both '' and '0'. It upgrades from version 33 to 74 with no errors and keeps every row. The schema matches a fresh 5.0 install apart from 2.x leftovers: two HelpDesk columns and the old_* backup tables 056 leaves.
If you can, please try your 2.3.1 copy again on the current dev-5.0.0 (not rc2). Your data may hold cases ours doesn’t. If anything still fails, the upgrader now stops at the exact statement and reports it, so please paste that report here.