Repository navigation
Harden CI: MySQL upgrade path, database matrix, schema diff, PHPStan - #1505
Merged
Merged
Conversation
The diff now also reads each table's engine and collation, column EXTRA (auto_increment, on update), the primary key apart from a unique index on the same columns, and the ON DELETE and ON UPDATE rules of foreign keys. Keys keep their spelling, so the accepted list is unchanged; its header now says an entry hides later changes under the same key. DB_HOST localhost reaches 127.0.0.1 over TCP, as db-prepare.sh does, instead of the local socket.
Before dropping, every base table of both databases is read, and one holding a row stops the script with exit 1 unless DB_PREPARE_FORCE=1. The wait loop gives each attempt a 5 s connect timeout and stops at once on ERROR 1045 or 1044. A DB_PASSWORD with a double quote or a newline is refused before the option file is written.
CLAUDE.md describes the extended schema diff, the db-prepare row guard and the exact exit codes, removes the example container afterwards and names the TB_ constant list in phpstan.neon.dist. The four schema tools are export-ignored while utils/db-schema-update keeps shipping, and .editorconfig keeps tabs in the generated phpstan-baseline.neon.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CI now fails a pull request on three kinds of error that have reached releases before: a migration chain that breaks on MySQL, drift between a migrated and a fresh schema, and new static analysis errors. The design record is
docs/specs/2026-11-11-ci-hardening-design.md.Migrations. On MySQL 8.4 and 9.7,
0.60.0-0.61.0.sqland0.62.0-0.63.0.sqlstopped on dropping an index or primary key that backs a foreign key, and on MariaDB-onlyIF EXISTSsyntax. That also left0.82.0-0.83.0.sqlfailing on the missingmessage.via_botcolumn. Both files now look keys up by column ininformation_schemaand apply changes throughPREPARE, so they run unchanged on both servers and can be run more than once.0.62.0-0.63.0.sqlwas meant to drop a duplicate foreign key onmessage.forward_fromnamedmessage_ibfk_6. MariaDB 12 names it6, so the drop was skipped. The file now finds the duplicate by column.telegram_update.poll_answer_poll_idkey is not restored after thepoll_answerprimary key is rebuilt, because MySQL refuses a foreign key to part of a composite key.0.83.1-0.84.0.sqlalready adds its reference topoll (id), as on MariaDB.Database matrix. PHP 8.1 to 8.5 runs on MariaDB 12.3, and PHP 8.5 also runs on MariaDB 10.11, MySQL 8.4 and MySQL 9.7. MariaDB 10.3, which is past end of life, is dropped. Each job does the following:
composer db-prepareloadsstructure.sqlinto one database, and the 0.44.1 schema plus every migration into another.composer schema-diffcompares the two.Schema diff.
utils/db-schema-diff.phpcompares the two databases throughinformation_schema:ON DELETEandON UPDATErules.Generated key names, comments and column order are ignored. Three known differences are accepted, each with a reason, in
utils/db-schema-diff-accepted.txt:botan_shortener,message.new_chat_memberand the length ofuser.username. An accepted entry that no longer matches any difference fails the diff too.Static analysis. PHPStan runs at level 5 over
src/(composer analyse), with a baseline holding the existing findings. It runs as aStatic analysisjob thatTestsdepends on. PHPStan is pinned to exactly 2.3.5, becausecomposer.lockis not committed and the baseline records exact error counts.