Can Portage provide reversible pkgdb migrations?
0 reputation · 17 May 2022, 11:42 UTC
The Portage package manager stores package metadata in a SQLite database located at /var/db/portage/pkgdb. When Portage is upgraded, a forward migration script may alter the schema to add new fields or indexes.
These migrations are currently one‑way; there is no built‑in reverse migration. A failed or incomplete migration can leave the database in an inconsistent state, and users must manually back up /var/db/portage before performing an upgrade.
Because the community has not yet agreed on a reversible migration strategy, it remains unclear how to provide a safe rollback path that integrates with the standard upgrade workflow.
What design options exist for adding reversible migrations to Portage? Which migration framework or tooling could support generating both forward and backward scripts? When should a rollback be automatically triggered, and how would the system detect a failed migration?