Restore legacy unique_keys[] support in the schema API (#8116)

* Restore legacy unique_keys[] support in the schema API

develop expresses a unique index as a `keys[]` entry with `'unique' => true`,
and both db_table_create() and db_update_table() were rewritten to only read
that form. Plugins that still use the legacy `unique_keys[]` definition style
(supported on 1.2.x) therefore get no UNIQUE index created, and any existing
one dropped on the next schema refresh.

Fold a legacy `unique_keys[]` definition into `keys[]` with the unique flag at
the top of both functions, so the existing unique-aware key handling applies
to it. New-style `keys[]` with `'unique' => true` continues to work unchanged.

* CHANGELOG: reference PR #8116

* Fix CHANGELOG format and add unique_keys[] regression coverage

CHANGELOG: use the -issue#8116 entry form (the -bug prefix and trailing (#NNNN) failed the CHANGELOG format check) and place it in the issue block so the security-issue-feature ordering holds. Adds DbUpdateTableUniqueKeysTest covering db_table_create() emitting the UNIQUE index and db_update_table() adding a missing one and preserving an existing one for a legacy unique_keys[] definition. FakeMySQLPDO now projects Seq_in_index/Column_name/Non_unique for named secondary indexes so the reconciliation path can be exercised.
This commit is contained in:
TheWitness authored and GitHub committed 2026-09-29 23:08:41 -04:00
1 parent ac2445fab5
commit d4f2bd1f3b
4 files changed
+141 -2

No files matched your search

+1
View File
@@ -28,6 +28,7 @@ Cacti CHANGELOG
-security: Keep LDAP directory errors out of the login page
-security: Demand TLS certificates for new LDAP domains
-security: Restore the Cacti error handler on LDAP bind-only and empty-password paths
-issue#8116: Restore legacy unique_keys[] support in db_table_create() and db_update_table() so plugins that declare UNIQUE indexes with that definition style keep them across a schema refresh
-issue#8105: Add a Force Uninstall action to remove an orphaned plugin whose directory is missing
-issue#7969: Restore excluded integration and mutation regression coverage
-issue#7969: Align Rocky Linux compatibility checks with the supported PHP runtime