/// // Add `gitSha` to client_logs: which BUILD wrote this row, not which version. // // WHY THIS MIGRATION EXISTS: `1.1.7+18` was built and installed at least four // times in one evening with materially different code in it. Two telemetry fields // were broken in the earlier builds — `lastLoadError` recorded a single obfuscated // letter and throughput reported -1 — and nothing in the stored rows could tell // those builds apart from the fixed one. So a real measurement from a real // television had to be discarded as "probably the old build", which is exactly the // kind of ambiguity a diagnostic pipeline must not have. // // A version number records an intent to release. The sha records the artifact. // // Fourth time the silent-drop lesson applies (hidden `profiles.pinHash`, // `client_logs.flavor`, `client_logs.tester`, now this): PocketBase discards an // undeclared key in a create payload with no error and HTTP 200, so a field the // client sends does not exist until a migration declares it. Written at the same // time as the client change rather than discovered afterwards. // // Not required, and empty in an ad-hoc local build. An absent sha honestly says // "unknown"; the release scripts pass `--dart-define=GIT_SHA=$(git rev-parse // --short HEAD)` so every published artifact carries one. migrate( (app) => { const logs = app.findCollectionByNameOrId("client_logs") logs.fields.add( new TextField({ name: "gitSha", required: false, max: 20, }), ) app.save(logs) }, (app) => { const logs = app.findCollectionByNameOrId("client_logs") logs.fields.removeByName("gitSha") app.save(logs) }, )