patched_migrations.py 504 B

123456789101112131415161718
  1. from contextlib import contextmanager
  2. from .patched_autodetector import patched_autodetector
  3. from .patched_project_state import patched_project_state
  4. @contextmanager
  5. def postgres_patched_migrations():
  6. """Patches migration related classes/functions to extend how Django
  7. generates and applies migrations.
  8. This adds support for automatically detecting changes in Postgres
  9. specific models.
  10. """
  11. with patched_project_state():
  12. with patched_autodetector():
  13. yield