Django Migrations: A Retrospective

Django Migrations: A Retrospective

A talk I gave at DjangoCon AU 2014.

077e9a0cb34fa3eba2699240c9509717?s=128

Andrew Godwin

August 01, 2014
Tweet

Transcript

  1. Andrew Godwin @andrewgodwin migrations: a retrospective

  2. Andrew Godwin Author of South migrations library Hi, I'm Author

    of 1.7 Django migrations I like my tea iced, and my schemas explicit
  3. Django/Python backend I work for Discovery? Mobile? Storage? UI? On-site?

    ...auditing? We have it all. We're hiring!
  4. Migrations They're pretty good.

  5. South ...it was good for its time

  6. The Initial Plan Django Schema backend ORM Hooks South 2

    Migration handling User interface
  7. The Revised Plan Django Schema backend ORM Hooks South 2

    Migration handling User interface Backport for 1.4 - 1.6
  8. The Revised Revised Plan Django Schema backend ORM Hooks Migration

    handling User interface
  9. Logically Separate SchemaEditor Schema Migrations field.deconstruct() ModelOptions.apps Operations Loader /

    Graph Executor Autodetector Optimiser State
  10. makemigrations field.deconstruct() Loader / Graph Autodetector Optimiser State Writer 1

    2 State 3 5 4
  11. migrate SchemaEditor ModelOptions.apps Operations Loader / Graph Executor State 1

    2 Recorder 3
  12. Moving South into Django instead, "Adding migrations to Django"

  13. A New Format More concise Declarative Introspectable

  14. Migration actions Frozen ORM

  15. None
  16. In-memory running Creates models from migration sets Autodetector diffs created

    from on-disk Used to feed SchemaEditor / ORM
  17. But what went wrong?

  18. Swappable Models

  19. Your migration dependencies myapp/0001 myapp/0002 otherapp/0001 auth/0001 contenttypes/0001

  20. myapp/0001 myapp/0002 otherapp/0001 auth/0001 contenttypes/0001 thirdapp/0001 Your migration dependencies on

    swappable models
  21. what? Your migration dependencies on swappable models myapp/0001 myapp/0002 otherapp/0001

    auth/0001 contenttypes/0001 thirdapp/0001 ???
  22. what? Your migration dependencies on swappable models myapp/0001 myapp/0002 otherapp/0001

    auth/0001 contenttypes/0001 thirdapp/0001 ???
  23. Unmigrated Apps

  24. Test persistence

  25. Test persistence on MySQL

  26. Random Meta options order_with_respect_to? Really?

  27. Proxy Models

  28. But we're close! Django 1.7, coming to a server near

    you soon.
  29. Thanks! Andrew Godwin andrewgodwin@eventbrite.com