From 763732fc5b55fbf90e7f13fa09c6ed101d641e11 Mon Sep 17 00:00:00 2001 From: Darkatek7 <50767771+Darkatek7@users.noreply.github.com> Date: Thu, 30 Jul 2026 10:37:17 +0200 Subject: [PATCH] romm: remove stale 1.x alembic migrations on update (#16101) * fix(romm): remove stale 1.x alembic migrations on update RomM releases before v2.4 shipped dot-version migration files (1.6.2_.py, 1.7.1_.py, 1.8_.py, 1.8.1_.py, 1.8.2_.py, 1.8.3_.py, 2.0.0_.py) alongside the 4-digit series. When the romm app is upgraded from a pre-v2.4 install to a current release, these files survive in /opt/romm/backend/alembic/versions/ and cause alembic to fail with 'Multiple head revisions are present for given argument head', preventing the backend from starting. Add a defensive cleanup step in the update function that runs right after fetch_and_deploy_gh_release. The cleanup removes any leftover 1.x and 2.0.0_ migration files plus cached __pycache__ directories. It is a no-op on clean installs of the current release, and only affects files in the alembic/versions/ folder. * Apply suggestion from @CrazyWolf13 Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --------- Co-authored-by: Sam Heinz Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- ct/romm.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ct/romm.sh b/ct/romm.sh index 4391d2b4c..4b977168b 100644 --- a/ct/romm.sh +++ b/ct/romm.sh @@ -44,6 +44,10 @@ function update_script() { CLEAN_INSTALL=1 fetch_and_deploy_gh_release "romm" "rommapp/romm" "tarball" "latest" "/opt/romm" + find /opt/romm/backend/alembic/versions -maxdepth 1 -type f -name '1.*.py' -delete 2>/dev/null || true + find /opt/romm/backend/alembic/versions -maxdepth 1 -type f -name '2.0.0_.py' -delete 2>/dev/null || true + find /opt/romm/backend -name '__pycache__' -type d -prune -exec rm -rf {} + 2>/dev/null || true + restore_backup msg_info "Updating ROMM"