Files
cacti/tests/Unit/Database
Thomas Vincent 2a40f44d21 fix(database): accept string-form key columns in db_update_table() refresh (#8737)
* fix(database): accept string-form key columns in db_update_table() refresh

db_update_table() passed each declared key's columns straight to
array_diff() when the table already existed. Plugins conventionally declare
those columns as a string, either a single column or the backtick-joined
'col1`,`col2' form, so a refresh through api_plugin_db_table_create()
raised a TypeError under PHP 8 and aborted the plugin install or upgrade.

Add db_index_columns_to_array() and normalize both the key columns and the
primary key before diffing them against SHOW INDEX. A matching index is no
longer rebuilt, and a backtick-joined primary key is compared per column
instead of as one name.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* docs(changelog): note the db_update_table() key column fix (#8736)

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-11-17 13:24:56 -05:00
..