From 33f7408ef16708e2654f8387f37b77045e73e674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?m=C3=BCde?= Date: Sun, 17 May 2026 01:21:40 +0200 Subject: [PATCH] =?UTF-8?q?scripts:=20forge-migrate.sh=20=E2=80=94=20run?= =?UTF-8?q?=20pending=20DB=20migrations=20+=20restart?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit for the 'table X has no column Y' class of schema-lag errors that showed up generating an access token on a fresh 11.0.13 install. --- scripts/forge-migrate.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 scripts/forge-migrate.sh diff --git a/scripts/forge-migrate.sh b/scripts/forge-migrate.sh new file mode 100755 index 0000000..bbdc5ba --- /dev/null +++ b/scripts/forge-migrate.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# Run pending Forgejo DB migrations + restart the daemon. +# +# Use after upgrading the forgejo package, or when a CLI command +# errors with "table X has no column named Y" (schema lag). +set -euo pipefail + +sudo nixos-container run hive-forge -- runuser -u forgejo -- \ + forgejo --work-path /var/lib/forgejo migrate + +sudo nixos-container run hive-forge -- systemctl restart forgejo +echo "forge: migrated + restarted"