Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Digging Into Django's Migrations

Andrew Godwin
September 03, 2014

Digging Into Django's Migrations

My keynote from DjangoCon US 2014

Andrew Godwin

September 03, 2014
Tweet

More Decks by Andrew Godwin

Other Decks in Programming

Transcript

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

    of 1.7 Django migrations Senior Software Engineer at
  2. South 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 1.0

    Aug 2008 Aug 2008 Sep 2008 Jan 2009 Apr 2009 Jun 2009 Mar 2010 May 2013 Jul 2014
  3. The Early Years 0.1 0.2 0.3 0.4 0.5 0.6 0.7

    0.8 1.0 Aug 2008 Aug 2008 Sep 2008 Jan 2009 Apr 2009 Jun 2009 Mar 2010 May 2013 Jul 2014
  4. Approaching Stability 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8

    1.0 Aug 2008 Aug 2008 Sep 2008 Jan 2009 Apr 2009 Jun 2009 Mar 2010 May 2013 Jul 2014 Well, in the short term, South 1.0 will be released. “ “ June 2010
  5. The Long Gap & Kickstarter 0.1 0.2 0.3 0.4 0.5

    0.6 0.7 0.8 1.0 Aug 2008 Aug 2008 Sep 2008 Jan 2009 Apr 2009 Jun 2009 Mar 2010 May 2013 Jul 2014
  6. Today 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 1.0

    Aug 2008 Aug 2008 Sep 2008 Jan 2009 Apr 2009 Jun 2009 Mar 2010 May 2013 Jul 2014
  7. For at least a year now, people have been suggesting

    to me that South should be in Django core. “ “ June 2010
  8. The Revised Plan Django Schema backend ORM Hooks South 2

    Migration handling User interface Backport for 1.4 - 1.6
  9. Operations are a declarative representation of model changes State is

    an in-memory representation of entire project state
  10. Compares two States and outputs a set of operations to

    perform Operations have own dependencies and resolver
  11. Model A Model A w/FK, Model B diff AddModel(B) AddField(A,

    "b", FK(B)) dependency sort AddModel(B) AddField(A, "b", FK(B)) BEFORE AFTER
  12. Takes one set of Operations and outputs another with the

    same effect Steps over pairs and checks if they combine and what they pass over