Skip to content

v4.1.1 — the install checks itself

Choose a tag to compare

@ejosterberg ejosterberg released this 26 Jul 06:10

TicketsCAD can now check — and repair — its own database structure.

Every health check up to now was about files: permissions, stale code, missing libraries. None of them could see the failure that actually costs a self-hoster an evening: a database whose structure has fallen behind the code, so a screen loads perfectly and then refuses to save with a bare HTTP 400.

That happened to a beta tester last week. His laptop lost power, a few tables were damaged, he re-created them — and then the Teams screen would not save. He ran the migrations. They told him everything was up to date. It took four rounds of email to find out why.

Upgrading

git pull
php sql/run_migrations.php

Docker needs the rebuild step as well:

git pull && docker compose up -d --build

Added

php tools/check-schema.php — asks your database whether it has the columns this version writes to, and reports exactly what is missing. It changes nothing.

php tools/check-schema.php --repair

re-applies the schema migrations and re-checks in a fresh process. The migrations are idempotent and delete nothing. If you want to be certain first, php tools/backup_run.php.

A "Database schema vs this version" row on Status → File & Code Health, so drift is visible before anyone hits it.

A save that fails on a missing column now explains itself — which column, that your data is intact, and the command to fix it — instead of an unexplained HTTP 400.

See docs/TROUBLESHOOTING.md#schema-out-of-date.

Fixed

The migration runner no longer reports health it has not verified. It decided "already applied" from its own tracker table — which records whether a migration script ran, not whether the schema that script produced still exists. So if a table was dropped during crash recovery, or the database was restored from an older backup, every script still read as applied: the runner did nothing and reported everything up to date while the application was broken. Recovering required --force, and nothing anywhere suggested it.

It now asks the database, and re-applies automatically when the two disagree.

Software that confidently reports health it has not checked is worse than software that reports nothing, and that is the part of this release worth caring about.

The commit-time schema gate could not see any of the writers. It examined each SQL string in isolation, but the code builds its queries by concatenation — so the INSERT keyword and the column list never appeared in the same string, and all 89 writer statements across 53 tables were silently skipped. That is why the previous release's teams problem reached a user instead of being caught before it shipped.

The gate now reads concatenated SQL, and a generated manifest of every column the code writes to — 128 tables, 1008 columns — is checked against your live database.

Keeping up to date

TicketsCAD is developed in the open and fixes land continuously. If you clone with git, staying current is git pull — you get corrections as they happen without waiting for a tagged release. Two short walkthroughs if git is new to you:

Full changelog: CHANGELOG.md