Read the Docs and PostgreSQL: Schema Migration Rollback Behavior
0 reputation · 27 Mar 2024, 19:28 UTC
Database State Management during Upgrades
Read the Docs utilizes the Django migration system to manage its PostgreSQL schema. During instance upgrades, migrations are applied to the database to ensure compatibility with the new release. However, the current architecture does not provide an automated mechanism to revert these changes if a deployment fails or if a specific migration introduces instability.
Transactional Integrity and Recovery
When a schema change is applied, the system relies on manual intervention via management commands to return to a previous state. There is an unresolved design consideration regarding whether migration steps should be wrapped in transactions to allow for automatic rollbacks upon failure, particularly for environments integrated with automated build triggers.
- Current behavior requires manual execution of migration reverts.
- Partial migration states may persist if an error occurs during the upgrade process.
Does the current stable v2.0 series support transactional migration wrappers to prevent partial schema updates? If not, what is the recommended strategy for ensuring schema consistency without relying on full database restores?