Commit Graph

2 Commits

Author SHA1 Message Date
johnnyq
69fd43051f Keep collations at utf8mb4_general_ci going forward: functions.php now ends by calling databaseConnectionCollation, which runs SET collation_connection = 'utf8mb4_general_ci' on the connection config.php opened, so a string the server makes itself, CAST(x AS CHAR) for one, matches the tables where on MySQL 8 it came out utf8mb4_0900_ai_ci and failed beside a column with Illegal mix of collations, on a new install as much as an upgraded one; only the collation is set and not the character set, no SET NAMES and no mysqli_set_charset, because on a server that defaults to latin1 the connection has always been latin1 and changing it shows every accented letter already stored as two wrong ones, where setting collation_connection alone leaves what is stored and what is stored after the same; admin/database_updates.php calls databaseCollationRepair after a run that applied at least one database update and finished, so a table a migration creates without a COLLATE is given the collation db.sql has in the same run, with what it changed and what it could not going to App Logs and to the output of scripts/update_cli.php, a table it cannot change left as it was and never failing the update, and a run that stops at a failed migration leaving this for the run that finishes; run on MySQL 8.0 and MariaDB 10.11, on a latin1 server default and through update_cli.php --update_db with a migration written as 2.4.1 was; CONTRIBUTING.md and the 26.11.7 changelog section say so 2026-11-11 20:52:46 -05:00
johnnyq
bce68aac6a Add a collation check and repair to Admin > Debug: functions/database_collation.php reads from db.sql each table's default collation and each text column's, compares them with information_schema and can give every table that differs the collation db.sql has for it, one ALTER a table with a MODIFY a column built from its SHOW CREATE TABLE line with only the collation replaced, as database 3.6.5 does, so a binary column that was flattened goes back to utf8mb4_bin too and no column type changes; the ITFlow section gains a Database collation check that warns when any table differs, and the Database card lists them under Structure a row a table, in Copy for support as well, with a Repair collations button behind a confirm; the button posts to the new admin/post/debug.php, CSRF-checked and not tied to the request so a large table is not cut off with the browser, which writes an audit log entry naming the tables changed and a warning in App Logs for each one it had to leave, a table being changed whole or not at all; tables and columns db.sql does not have are not looked at; run through the page and against the whole schema on MySQL 8.0 and MariaDB 10.11; add both to the 26.11.7 changelog section 2026-11-11 20:33:19 -05:00