scripts: forge-migrate.sh — run pending DB migrations + restart

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.
This commit is contained in:
müde 2026-05-17 01:21:40 +02:00
parent a1c4d37bc9
commit 33f7408ef1

12
scripts/forge-migrate.sh Executable file
View file

@ -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"