1
0
forked from Proxmox/ProxmoxVE

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 <sam@samheinz.com>
Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com>
This commit is contained in:
Darkatek7
2026-07-30 10:37:17 +02:00
committed by GitHub
parent e456b1fc96
commit 763732fc5b
+4
View File
@@ -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"