Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up
for free
Django Migrations: A Retrospective
Andrew Godwin
August 01, 2014
Programming
2
230
Django Migrations: A Retrospective
A talk I gave at DjangoCon AU 2014.
Andrew Godwin
August 01, 2014
Tweet
Share
More Decks by Andrew Godwin
See All by Andrew Godwin
andrewgodwin
0
90
andrewgodwin
0
73
andrewgodwin
0
270
andrewgodwin
1
250
andrewgodwin
0
46
andrewgodwin
2
670
andrewgodwin
1
120
andrewgodwin
0
36
andrewgodwin
0
96
Other Decks in Programming
See All in Programming
oleindesign
1
200
takara9
0
150
mfunaki
1
770
ntaro
0
160
mploed
3
160
sters
2
120
mrtc0
2
910
manfredsteyer
PRO
0
140
grapecity_dev
0
160
yotuba088
1
570
danilop
0
220
pyama86
4
410
Featured
See All Featured
rocio
155
11k
geeforr
332
29k
keathley
20
700
lynnandtonic
272
16k
keavy
106
14k
colly
188
14k
bkeepers
321
53k
chriscoyier
499
130k
philnash
9
580
stephaniewalter
260
11k
holman
461
280k
dotmariusz
94
5.5k
Transcript
Andrew Godwin @andrewgodwin migrations: a retrospective
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
Django/Python backend I work for Discovery? Mobile? Storage? UI? On-site?
...auditing? We have it all. We're hiring!
Migrations They're pretty good.
South ...it was good for its time
The Initial Plan Django Schema backend ORM Hooks South 2
Migration handling User interface
The Revised Plan Django Schema backend ORM Hooks South 2
Migration handling User interface Backport for 1.4 - 1.6
The Revised Revised Plan Django Schema backend ORM Hooks Migration
handling User interface
Logically Separate SchemaEditor Schema Migrations field.deconstruct() ModelOptions.apps Operations Loader /
Graph Executor Autodetector Optimiser State
makemigrations field.deconstruct() Loader / Graph Autodetector Optimiser State Writer 1
2 State 3 5 4
migrate SchemaEditor ModelOptions.apps Operations Loader / Graph Executor State 1
2 Recorder 3
Moving South into Django instead, "Adding migrations to Django"
A New Format More concise Declarative Introspectable
Migration actions Frozen ORM
None
In-memory running Creates models from migration sets Autodetector diffs created
from on-disk Used to feed SchemaEditor / ORM
But what went wrong?
Swappable Models
Your migration dependencies myapp/0001 myapp/0002 otherapp/0001 auth/0001 contenttypes/0001
myapp/0001 myapp/0002 otherapp/0001 auth/0001 contenttypes/0001 thirdapp/0001 Your migration dependencies on
swappable models
what? Your migration dependencies on swappable models myapp/0001 myapp/0002 otherapp/0001
auth/0001 contenttypes/0001 thirdapp/0001 ???
what? Your migration dependencies on swappable models myapp/0001 myapp/0002 otherapp/0001
auth/0001 contenttypes/0001 thirdapp/0001 ???
Unmigrated Apps
Test persistence
Test persistence on MySQL
Random Meta options order_with_respect_to? Really?
Proxy Models
But we're close! Django 1.7, coming to a server near
you soon.
Thanks! Andrew Godwin andrewgodwin@eventbrite.com