fix(migrations): load composer autoloader so run.php works on a fresh DB

run.php never loaded vendor/autoload.php. SQL migrations were fine, but PHP
migrations run as isolated subprocesses that require src/ files directly, and
those files reference sibling classes (e.g. Database -> DatabaseMigrations)
resolvable only via composer's classmap. On a fresh schema.sql database the run
died at 013_fix_remarks_keywords.php with:

  Class "DatabaseMigrations" not found in app/src/Database.php:89

- run.php now resolves and requires the autoloader (vendor/ is a sibling dir in
  dev, same-dir in prod, matching app/bootstrap.php).
- Subprocess PHP migrations get it injected via -d auto_prepend_file so each
  migration's own contract is untouched ($argv[1] stays the DB path).

Verified: fresh schema.sql DB applies 47 migrations, exit 0; second run is a
no-op (0 applied).
This commit is contained in:
Pontoporeia
2026-09-18 16:26:49 +02:00
parent 82d678c7b0
commit 3ab03e2c7a
2 changed files with 39 additions and 4 deletions
+1 -2
View File
@@ -65,6 +65,7 @@
- [x] #extend-smoke-test-for Extend smoke test for rotation and 4h idle boundary
- [x] #fix-14-biome-check Fix 14 biome check errors: unsorted imports in scripts/css-*.mjs + unformatted CSS/JS files
- [x] #fix-peertube-resumable-chunked-upload [!high] fix(peertube): resumable chunked upload to stop 504 on large A/V — Admin MP4 upload fails at 100%: PHP relays whole file to PeerTube via one blocking multipart POST; PeerTube edge nginx returns 504 Gateway Time-out (see xamxam-error log filepond_peertube). Migrate PeerTubeService::upload() to resumable upload protocol with chunked PATCH so no single request exceeds the proxy timeout.
- [x] #fix-migrations-run-php-not-loading Fix migrations/run.php not loading composer autoloader (fresh-DB failure) — run.php loaded no autoloader; PHP subprocess migrations require src/ files whose sibling classes (Database->DatabaseMigrations) only resolve via composer classmap. Loaded autoloader in run.php and injected into subprocesses via -d auto_prepend_file, preserving $argv[1]=db contract. Verified: fresh schema.sql DB applies 47 migrations, exit 0, idempotent on 2nd run.
## Deferred / Blocked
- [ ] #just-setup-backs-a [!medium] just setup backs a stale setup-dev.sh (clones php-live-reload, legacy admin/data/ dirs) — needs rewrite or removal
@@ -75,5 +76,3 @@
- [ ] #wire-templates-to-load [!medium] Wire templates to load their page-type bundle instead of base.min.css — Update each template's <link> tags to point at the appropriate per-page bundle. Ensure no page loads CSS it doesn't need and that shared pages still get full styling.
- [ ] #measure-before-after-css-bytes [!low] Measure before/after CSS bytes shipped per page type — Moot: part of split stream which is NO-GO (task 14). Skip unless split is revived.
- [ ] #add-lightningcss-unusedsymbols-report-only [!high] Add lightningcss unusedSymbols report-only pass for base.min.css — SEQUENCING: do this (unusedSymbols report-only) BEFORE the per-page split (u). Reasoning: high priority, zero-risk diagnostic-only, produces reclaimable-byte go/no-go (14) against ~216KB baseline; if pruning is not worthwhile the split may not be either. Reuses inventory from v (docs/css-split-analysis.md). Start: 11 collect-content-sources.
- [x] #trim-deploy-code-comments Remove oversized comment blocks from deploy-code/deploy-permissions recipes in justfile.