Summary
When upgrading a Docker container to a new version while reusing an existing database volume, new columns added in recent versions are missing from the database. This causes PDOException: no such column errors at runtime.
Sentry Evidence
Three related errors from the same server (mikopbx-in-a-docker, release 2026.1.223, PHP 8.4.16):
| Sentry # |
Error |
Missing Column |
| #27959 |
no such column: m_LanInterfaces.ipv6_mode |
ipv6_mode (added for IPv6 support) |
| #27960 |
no such column: m_AsteriskManagerUsers.eventfilter |
eventfilter (AMI event filtering) |
| #27961 |
no such column: m_Iax.registration_type |
registration_type (IAX registration) |
All 6 events each, 1 user, triggered via SIPConf::reload() → WorkerModelsEvents.
Expected Behavior
UpdateDatabase::updateDatabaseStructure() runs during boot via SystemLoader::startSystem() and should detect missing columns from model @Column annotations, then add them via ALTER TABLE ADD COLUMN.
Potential Root Cause
In UpdateDatabase::getAddableColumns() (line ~580-621): when extra columns exist in the database that are NOT in the model (e.g., from a previous version or module), the function returns null for core models. This triggers the slow path (full table copy via temp table). During the copy, array_intersect($newColNames, $oldColNames) only transfers data for columns present in both old and new schemas — but the new table structure itself should still have the new columns.
Possible scenarios:
- Migration errors are silently caught and the old table structure is preserved
- The migration doesn't run at all in certain Docker upgrade paths
- A schema comparison mismatch causes the migration to skip the table entirely
Reproduction
- Run MikoPBX Docker with an older version (pre-IPv6, e.g.,
2025.1.x)
- Create some data (extensions, settings)
- Upgrade container image to
2026.1.223 while keeping the cf volume
- Check database:
sqlite3 /cf/conf/mikopbx.db ".schema m_LanInterfaces" | grep ipv6_mode
Files to Investigate
src/Core/System/Upgrade/UpdateDatabase.php — main migration logic
src/Core/System/Upgrade/UpdateDatabase.php:getAddableColumns() — column addition decision
src/Core/System/SystemLoader.php:startSystem() — boot sequence calling migration
src/Core/System/ContainerEntrypoint.php — Docker/LXC boot entry point
Affected Models
src/Common/Models/LanInterfaces.php — ipv6_mode, ipv6addr, ipv6_subnet, ipv6_gateway, primarydns6, secondarydns6
src/Common/Models/AsteriskManagerUsers.php — eventfilter
src/Common/Models/Iax.php — registration_type
Summary
When upgrading a Docker container to a new version while reusing an existing database volume, new columns added in recent versions are missing from the database. This causes
PDOException: no such columnerrors at runtime.Sentry Evidence
Three related errors from the same server (
mikopbx-in-a-docker, release2026.1.223, PHP 8.4.16):no such column: m_LanInterfaces.ipv6_modeipv6_mode(added for IPv6 support)no such column: m_AsteriskManagerUsers.eventfiltereventfilter(AMI event filtering)no such column: m_Iax.registration_typeregistration_type(IAX registration)All 6 events each, 1 user, triggered via
SIPConf::reload()→WorkerModelsEvents.Expected Behavior
UpdateDatabase::updateDatabaseStructure()runs during boot viaSystemLoader::startSystem()and should detect missing columns from model@Columnannotations, then add them viaALTER TABLE ADD COLUMN.Potential Root Cause
In
UpdateDatabase::getAddableColumns()(line ~580-621): when extra columns exist in the database that are NOT in the model (e.g., from a previous version or module), the function returnsnullfor core models. This triggers the slow path (full table copy via temp table). During the copy,array_intersect($newColNames, $oldColNames)only transfers data for columns present in both old and new schemas — but the new table structure itself should still have the new columns.Possible scenarios:
Reproduction
2025.1.x)2026.1.223while keeping thecfvolumesqlite3 /cf/conf/mikopbx.db ".schema m_LanInterfaces" | grep ipv6_modeFiles to Investigate
src/Core/System/Upgrade/UpdateDatabase.php— main migration logicsrc/Core/System/Upgrade/UpdateDatabase.php:getAddableColumns()— column addition decisionsrc/Core/System/SystemLoader.php:startSystem()— boot sequence calling migrationsrc/Core/System/ContainerEntrypoint.php— Docker/LXC boot entry pointAffected Models
src/Common/Models/LanInterfaces.php—ipv6_mode,ipv6addr,ipv6_subnet,ipv6_gateway,primarydns6,secondarydns6src/Common/Models/AsteriskManagerUsers.php—eventfiltersrc/Common/Models/Iax.php—registration_type