Files
ProxmoxVE/install
CanbiZ (MickLesk) ba87729be7 sparkyfitness: run the Better Auth migration during the update (#17318)
* sparkyfitness: run the Better Auth migration during the update

1.7.1 ships a Better Auth version whose schema has columns 1.6.5 never
created, and nothing in the update adds them. The backend starts, then
refuses every sign-in:

  Database schema mismatch
    Missing columns session.impersonated_by two_factor.verified ...
    Run `npx auth migrate` to add the missing tables and columns.

Run exactly that after the backend dependencies are in place, with the
config Better Auth looks for, SparkyFitnessServer/auth.ts, and the
database credentials from /etc/sparkyfitness/.env. Users who hit this
were left running the server by hand to get the columns created.

A failure warns instead of aborting: the rest of the update has already
succeeded at that point, and the message names the remaining step.

* sparkyfitness: start the server through the entrypoint that migrates

The Better Auth CLI added in the previous commit is the wrong tool. It
generates sso_provider.user_id as text and cannot reference this
schema's uuid user.id:

  foreign key constraint "sso_provider_user_id_fkey" cannot be
  implemented [...] incompatible types: text and uuid

The real cause is one line up in the unit. It ran

  tsx SparkyFitnessServer.js

which imports the application module directly and never applies the
schema migrations. Upstream starts through index.ts - nodemon.json has
exec: tsx index.ts - and that file runs applyMigrations() and
applyRlsPolicies() before importing anything, with a comment naming this
exact failure:

  Better Auth validates the database schema eagerly, the moment
  betterAuth() is constructed at auth.ts module scope [...] When
  migrations ran later (from inside SparkyFitnessServer.ts) that check
  read the pre-migration schema on the first boot after an upgrade, so
  every /api/auth request failed until the container was restarted.

Point both the install and the update at index.ts and drop the CLI call.
index.ts exits non-zero when a migration fails, so systemd surfaces that
instead of serving a broken login.
2026-09-17 13:39:36 +02:00
..
2026-08-24 17:09:34 +02:00
2026-08-26 22:09:11 +10:00
2026-06-12 09:27:45 +02:00
2026-04-21 15:21:29 +02:00
2026-08-24 17:11:26 +02:00
2026-07-16 18:01:44 +10:00
2026-08-25 16:09:04 +02:00
2026-08-26 22:09:19 +10:00
2026-09-07 16:57:57 +02:00
2026-09-10 15:10:59 +02:00
2026-07-27 20:41:01 +10:00
2026-04-28 08:41:36 +02:00
2026-03-05 15:58:47 +01:00
2026-09-08 11:20:32 +02:00
2026-08-30 20:53:34 +02:00
2026-06-27 21:07:03 +02:00
2026-08-26 13:42:52 +02:00
2026-07-27 10:32:20 +02:00
2026-04-01 22:08:18 +02:00
2026-06-29 22:30:31 +02:00
2026-08-26 22:07:45 +10:00
2026-06-29 09:59:43 +02:00
2026-08-14 16:03:28 +02:00
2026-06-30 19:44:42 +10:00
2026-08-26 13:42:13 +02:00
2026-08-10 09:11:15 +02:00
2026-08-14 16:07:15 +02:00
2026-09-12 11:52:55 +02:00
2026-09-12 14:24:00 +02:00
2026-08-26 08:48:51 +02:00
2026-08-04 23:02:28 +02:00
2026-07-05 22:28:00 +02:00
2026-08-08 12:37:57 +10:00
2026-07-17 14:30:55 +02:00
2026-03-15 20:08:39 +01:00
2026-09-07 16:51:29 +02:00
2026-06-16 13:26:24 +02:00
2026-01-31 00:10:38 +01:00
2026-07-13 17:39:10 +02:00
2026-09-09 15:25:01 +02:00
2026-05-19 08:50:45 +02:00
2026-09-10 15:02:09 +02:00
2026-09-01 22:25:05 +02:00
2026-09-07 16:53:13 +02:00
2026-04-22 07:43:20 +02:00
2026-05-24 12:27:38 +02:00
2026-08-14 16:07:03 +02:00
2026-05-02 19:00:19 +02:00
2026-03-05 15:58:10 +01:00
2026-08-14 15:57:31 +02:00
qf
2026-08-05 17:35:32 +02:00
2026-07-15 20:55:10 +10:00
2026-03-24 11:49:03 +01:00
2026-07-27 09:53:27 +02:00
2026-03-08 13:25:24 +01:00
2026-08-30 20:53:12 +02:00
2026-08-26 13:42:32 +02:00
2026-08-26 13:41:49 +02:00
2026-08-07 19:41:33 +02:00
2026-09-02 16:32:44 +02:00
2026-07-30 10:06:57 +02:00
2026-06-25 14:06:24 +02:00
2026-09-10 15:02:18 +02:00
2026-08-25 15:11:31 +02:00
2026-09-02 16:31:34 +02:00
2026-03-27 11:14:06 +01:00
2026-08-24 17:07:31 +02:00
2026-08-14 22:12:35 +02:00
2026-09-10 13:49:15 +02:00
2026-07-26 19:04:53 +02:00
2026-08-27 09:56:12 +02:00
2026-08-15 23:41:31 +02:00
2026-07-27 10:03:11 +02:00
2026-08-30 20:55:03 +02:00
2026-05-19 23:42:26 +02:00
2026-02-23 19:21:26 +01:00
2026-03-18 08:43:40 +01:00
2026-02-05 15:31:45 +01:00
2026-02-05 15:31:45 +01:00
2026-07-10 10:57:27 +02:00
2026-08-12 13:45:10 +02:00
2026-09-08 11:18:20 +02:00
2026-04-28 09:18:27 +02:00
2026-02-27 13:54:45 +01:00
2026-08-13 08:58:35 +02:00
2026-05-29 23:49:34 +02:00
2026-03-28 15:18:10 +01:00
2026-05-01 22:44:29 +02:00
2026-03-20 09:06:25 +01:00
2026-08-20 14:27:23 +02:00
2026-07-27 12:50:46 +02:00
2026-09-15 09:16:43 +02:00
2026-03-22 09:40:31 +01:00
2026-08-22 00:39:29 +02:00
2026-06-06 16:08:46 +02:00
2026-01-31 22:51:38 +01:00