GitHub Enterprise Server upgrade: database schema inconsistency after migration failure
0 reputation · 30 Jun 2021, 05:49 UTC
0 reputation · 30 Jun 2021, 05:49 UTC
GitHub Enterprise Server performs database migrations as part of the upgrade process. In scenarios where a migration fails, the system may enter an inconsistent state where the application code is updated to the new version, but the database schema remains at the previous version.
The upgrade tool logs these failures to /var/log/enterprise-server/upgrade.log, but it does not automatically revert the schema to match the previous application version. This creates uncertainty regarding the system's ability to serve traffic or maintain data integrity while in this partial state.
Does the application continue to serve traffic when a migration fails but the code update completes? What is the documented method for verifying schema consistency via the schema_migrations table before initiating a manual rollback?
No. When a GitHub Enterprise Server upgrade fails during the database migration phase, the appliance does not continue serving normal application traffic. The code is updated to the new version, but the database schema remains at the previous version, so the application typically rejects requests and displays a maintenance or error page until the schema is brought into a consistent state.
Confirmed: GHES upgrades run database migrations before declaring success. If a migration fails, the upgrade tool logs the failure to /var/log/enterprise-server/upgrade.log and does not automatically revert the schema. The result is a version mismatch between application code and database schema.
Likely but version-dependent: The exact user-facing behavior (hard error page vs. limited read-only access) and the availability of automatic rollback hooks vary by release. Older GHES versions may not include rollback hooks at all. Treat any specific rollback procedure as version-specific and verify it against the documentation for your exact target release before proceeding.
Before attempting a manual rollback, confirm whether the schema is at the expected target version. The internal database records applied migrations in the schema_migrations table.
sudo /usr/local/share/enterprise/ghe-dbconsole, but confirm the exact path for your release.SELECT MAX(version) FROM schema_migrations;/var/cache/enterprise-upgrade/) varies by version and should be verified locally.Always take a fresh backup of the GHES database before any manual schema inspection or rollback. Manual rollback procedures are not universal across GHES releases; attempting one without the correct version-specific hooks can leave the database in an unusable state. If the query above returns a mismatch and no safe rollback path exists for your version, restoring the appliance from the pre-upgrade backup is the conservative recovery path.
Which exact GHES version were you upgrading from and to? Rollback hooks, database client paths, and the location of the expected schema version file differ across major GHES releases, so the version pair determines whether a manual rollback is even supported.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.