From 8d8fbe2903b9d03cc542acf287aa65dda140aaf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Sun, 16 Aug 2026 10:17:25 +0000 Subject: [PATCH] delete the global push from the server, keep the warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `pushSchema()` had no callers left once installs stopped using it, and it is not the kind of dead code worth keeping around: it is a one-line way to run the exact command that stopped applying anything on a real server, and dropped tables when forced. The doc comment stays in its place, because the useful artefact is the reason rather than the function. `bun db:push` remains correct in exactly one situation — `officer-setup`'s build step, on a machine with no tables yet, where "make the database match this schema" is an instruction with no ambiguity to resolve. Every other caller now has a scoped path. tsgo clean, frontend builds, 873 pass / 7 fail unchanged. Co-Authored-By: Claude Opus 5 --- src/servers/plugins/schema.ts | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/servers/plugins/schema.ts b/src/servers/plugins/schema.ts index 50187d98..bf3243f7 100644 --- a/src/servers/plugins/schema.ts +++ b/src/servers/plugins/schema.ts @@ -190,20 +190,15 @@ export default defineConfig({ } /** - * Apply the schema to Postgres. + * The global push — `bun db:push` over the whole schema — is deliberately NOT used by installs. * - * Shells out to the same `bun db:push` a human runs, rather than driving drizzle-kit in-process: it is - * one definition of "apply the schema" instead of two that can disagree, and an owner can reproduce - * exactly what an install did with a command they already know. + * It was removed as a plugin's install step on 2026-08-16 and is not replaced by anything here: nothing + * in the server should run it. `scripts/setup/officer-setup/lib/build.sh` still does, once, on a machine + * that has no tables yet, which is the only situation where "make the database match this schema" is a + * safe instruction. * - * `--force` because there is nothing to prompt about by construction — the barrel only ever gains entries - * unless a plugin's source is deleted — and a prompt with no terminal attached would hang the install - * forever rather than fail it. + * On any machine that already holds tables the schema does not declare, that command is a trap. It stops + * on an interactive rename prompt no non-TTY caller can answer (applying nothing and exiting 0), and + * `--force` converts that into dropping every one of those tables. Both were observed on a real server: + * see `pushPluginSchema` below for the full account and for what installs do instead. */ -export async function pushSchema(onLog?: OnLog): Promise { - // Streamed rather than captured. drizzle writes progress to stderr and results to stdout, and this is - // the command that reported success while creating nothing — so what it says is worth showing at the - // time it says it, not summarised into a exit code afterwards. - const result = await runLogged(['bun', 'run', 'db:push', '--force'], { cwd: PLATFORM_DIR, onLog }); - return { ok: result.ok, ms: result.ms, output: result.output.slice(-600) }; -}