Django migration dry-run execution on transactional backends
0 reputation · 04 May 2020, 20:49 UTC
Goal
Validate that a Django migration applies cleanly without permanently changing the schema or recording it in django_migrations. The deployment target uses PostgreSQL, where Django wraps each migration in a transaction by default.
migrate --plan previews operations without executing them, while migrate --fake records a migration as applied without running SQL. Neither executes the migration inside a transaction and then rolls it back to confirm safety.
Is there a supported way to run migrations in a disposable transaction on Django 4.2 LTS? If not, is restoring a database copy the only reliable pre-upgrade validation method?