Skip to Content Skip to Menu

CB Activity 7.1.1 installation failure during reply_depth migration on MariaDB

1 hour 34 minutes ago #344654 by m.o.skirde
Hello Kyle,the installation/update of CB Activity 7.1.1 fails during the 
Code:
reply_depth
 migration.System environment:
  • Joomla: 6.2.0
  • Community Builder: 2.12.0
  • CB Activity package: 
    Code:
    plug_cbactivity_7.1.1+2026.10.12.zip
  • PHP: 8.4.26
  • Database: MariaDB 10.11.18
  • Database driver reported by Joomla: MySQL
Actual installer error:
Code:
CB Activity Migration (reply_depth) Failed! Please Re-Install to Retry. Error: Unknown column 'c.reply' in 'SET'
AnalysisThe failure originates in 
Code:
install.cbactivity.php
, in the post-installation migration that calculates and stores the nesting depth of existing comments.The generated SQL is structured as follows:
Code:
UPDATE `#__comprofiler_plugin_activity_comments` AS c LEFT JOIN `#__comprofiler_plugin_activity_comments` AS p1 ON p1.`id` = c.`parent_id` LEFT JOIN ... SET c.`reply` = IF(...) WHERE c.`parent_id` > 0
The problematic part is the qualified target column on the left-hand side of the assignment:
Code:
SET c.`reply` = ...
MariaDB does not accept the table alias qualification in this position. It interprets 
Code:
c.reply
 as an unresolved column name and returns:
Code:
Unknown column 'c.reply' in 'SET'
The 
Code:
reply
 column itself is not missing from the package schema. It is declared in 
Code:
cbactivity.xml
:
Code:
<column name="reply" type="sql:int(11)" default="0" />
Therefore, the error does not appear to be caused by a missing schema declaration. It is caused by the SQL syntax used by the migration.Proposed correctionThe assignment target should be unqualified:
Code:
SET `reply` = IF(...)
In the PHP installer code, the current expression is effectively:
Code:
. " SET c." . $_CB_database->NameQuote('reply') . " = IF(...)"
It should be changed to:
Code:
. " SET " . $_CB_database->NameQuote('reply') . " = IF(...)"
The aliases can continue to be used in the joins, the expression and the 
Code:
WHERE
 clause. Only the target column on the left-hand side of 
Code:
SET
 needs to be unqualified.Steps to reproduce
  1. Use a site with an earlier CB Activity version and existing Activity comment data.
  2. Run the update using 
    Code:
    plug_cbactivity_7.1.1+2026.10.12.zip
    .
  3. Allow the installer to execute the migration for versions earlier than 7.1.0.
  4. The 
    Code:
    reply_depth
     migration fails with the error shown above.
Expected resultThe installer should calculate the reply depth of existing comments, write it to the 
Code:
reply
 column and complete the update successfully.Actual resultThe migration terminates with an SQL error, and the CB Activity update is reported as failed.Additional concern: partially completed installation stateBecause the error occurs during a post-installation migration, it would be useful to verify whether the extension version and schema changes may already have been registered before the migration fails.If the installed version is recorded as 7.1.1 despite the failed migration, a subsequent reinstall could potentially skip this block because it is guarded by:
Code:
if (version_compare($currentRelease, '7.1.0', '<')) { // reply-depth migration }
In that situation, the package might install successfully on a retry while existing records still contain uncalculated reply-depth values.I therefore recommend that the corrected installer also verifies whether the migration actually completed, rather than relying exclusively on the previously recorded extension version. An explicit migration marker or an idempotent data check would make recovery from a partially completed update safer.Please let me know if you need the complete package, database schema information or additional installation diagnostics.

Best regards, MO

Please Log in or Create an account to join the conversation.

59 minutes ago #344655 by m.o.skirde
Additional findings from CB Activity 7.1.1 migration recovery tests on MariaDB 10.11Hello,we performed a series of controlled recovery tests after the CB Activity 7.1.1 update failed. The tests revealed that the problem is not limited to the original SQL alias in the 
Code:
reply_depth
 migration.System environment:
  • Joomla: 6.2.0
  • Community Builder: 2.12.0
  • PHP: 8.4.26
  • Database: MariaDB 10.11.18
  • Database driver reported by Joomla: MySQL
  • Target package: 
    Code:
    plug_cbactivity_7.1.1+2026.10.12.zip
  • Previously working CB Activity version: 6.2.0
Original failureThe original package failed with:
Code:
CB Activity Migration (reply_depth) Failed! Error: Unknown column 'c.reply' in 'SET'
The relevant migration uses an eleven-table self-join:
Code:
UPDATE #__comprofiler_plugin_activity_comments AS c LEFT JOIN #__comprofiler_plugin_activity_comments AS p1 ... LEFT JOIN #__comprofiler_plugin_activity_comments AS p10 ... SET c.`reply` = ... WHERE c.`parent_id` > 0
The 7.1.1 manifest declares the new column:
Code:
<column name="reply" type="sql:int(11)" default="0" />
The previously installed 6.2.0 manifest does not contain this column.Test 1: Remove the alias from the assignment targetThe assignment was changed from:
Code:
SET c.`reply` = ...
to:
Code:
SET `reply` = ...
Result:
Code:
CB Activity Migration (reply_depth) Failed! Error: Unknown column 'reply' in 'SET'
This showed that the problem was not resolved by removing the alias. At this point, the new 
Code:
reply
 column was apparently not available to the migration.Test 2: Add the column conditionally during postflightA guard was added before the migration:
Code:
ALTER TABLE #__comprofiler_plugin_activity_comments ADD COLUMN IF NOT EXISTS `reply` INT(11) NOT NULL DEFAULT 0 AFTER `parent_id`
The self-join was also replaced with a non-join migration that:
  1. loads only 
    Code:
    id
     and 
    Code:
    parent_id
    ;
  2. calculates the reply depth in PHP, up to the original limit of ten;
  3. writes the results using ordinary single-table 
    Code:
    UPDATE
     statements in batches.
Result:
Code:
CB Activity Migration (reply_depth_v5) Failed! Error: Unknown column 'reply' in 'SET'
The installer did not report an error for the preceding 
Code:
ALTER TABLE
, but 
Code:
reply
 was still unavailable during the following update.Test 3: Move schema preparation to preflightThe column preparation was moved to 
Code:
preflight()
, before Community Builder performs its schema synchronization. The guard was repeated in 
Code:
postflight()
.A direct availability test was added immediately before the data migration:
Code:
SELECT `reply` FROM #__comprofiler_plugin_activity_comments LIMIT 0
Result:
Code:
CB Activity Migration (reply_depth_v6) Failed! Error: Unknown column 'reply' in 'SELECT'
This confirmed that the column was still unavailable immediately before the data migration.Test 4: Replace cached schema checks with direct physical checksTo rule out cached Community Builder schema metadata, the package used:
Code:
SHOW COLUMNS FROM ...
It then executed a classic, non-conditional:
Code:
ALTER TABLE ... ADD `reply` INT(11) NOT NULL DEFAULT 0 AFTER `parent_id`
The database operation did not produce an exception. However, the subsequent physical check still could not find the column.Result:
Code:
CB Activity Migration (reply_depth_schema_preflight_v7) Failed! Error: The reply column is still unavailable after ALTER TABLE.
Test 5: Resolve the physical table and query INFORMATION_SCHEMATo eliminate possible 
Code:
#__
 prefix replacement or schema-cache effects, the physical table name was resolved explicitly:
Code:
np0d7_comprofiler_plugin_activity_comments
Column existence was then checked directly using:
Code:
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'np0d7_comprofiler_plugin_activity_comments' AND COLUMN_NAME = 'reply'
The 
Code:
ALTER TABLE
 operation again returned without a caught exception, but the immediate 
Code:
INFORMATION_SCHEMA
 check still returned no 
Code:
reply
 column.Result:
Code:
CB Activity Migration (reply_depth_schema_preflight_v8) Failed! Error: The reply column is still absent from INFORMATION_SCHEMA after ALTER TABLE on np0d7_comprofiler_plugin_activity_comments.
Recovery resultWe stopped further modifications at this point and reinstalled the original CB Activity 6.2.0 package:
Code:
plug_cbactivity_6.2.0+build.2026.04.16.16.44.21.f05970673.zip
The installation completed successfully.No Activity tables were deleted, and no manual database modifications were performed.ConclusionsThe findings indicate two separate issues.1. The original reply-depth migration is not portable as writtenThe migration uses a deeply nested self-join and assigns to an aliased target:
Code:
SET c.reply = ...
This fails on the tested MariaDB 10.11 installation.Changing the assignment to an unqualified column or to the physical table-qualified column did not provide a reliable solution in this multi-table update.A safer migration would avoid this self-join update entirely. Possible approaches include:
  • calculating depths in application code and updating rows in batches;
  • using a temporary materialized result followed by a simple update;
  • another migration strategy explicitly tested against MariaDB 10.11 and supported MySQL versions.
2. The 
Code:
reply
 column is not available when the migration runsAlthough 
Code:
reply
 is declared in the 7.1.1 manifest, it is not available during the 
Code:
reply_depth
 migration in this installation path.Tests in both 
Code:
preflight()
 and 
Code:
postflight()
 showed that the column could not be reliably observed after an attempted 
Code:
ALTER TABLE
. Even a direct 
Code:
INFORMATION_SCHEMA.COLUMNS
 check using the resolved physical table name did not find it.This suggests that the schema update and data migration ordering requires review. It may also be necessary to inspect how the Community Builder installer handles DDL statements, schema synchronization and rollback during a failed nested package installation.Recommended installer changesWe recommend that the corrected release:
  1. Ensures the 
    Code:
    reply
     column is physically present before any data migration begins.
  2. Verifies the physical schema rather than relying only on the extension version.
  3. Treats failure to create or verify the column as a distinct schema error.
  4. Replaces the current self-join migration with a MariaDB-compatible strategy.
  5. Makes the migration idempotent.
  6. Records an explicit migration-completion marker.
  7. Does not rely exclusively on:
Code:
version_compare($currentRelease, '7.1.0', '<')
A failed installation may leave files, schema changes, version information or migration state partially updated.
  1. Supports safe retry after a failed installation.
  2. Reports the executed migration phase and underlying SQL error separately.
  3. Tests the complete update path from CB Activity 6.2.0 to 7.1.1 on MariaDB 10.11.
Current operational stateThe site is currently running the successfully restored CB Activity 6.2.0 package. We will not retry the 7.1.1 update until an official corrected package is available.

Best regards, MO

Please Log in or Create an account to join the conversation.

Moderators: beat, nant, krileon
Powered by Kunena Forum