Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Django Migrations: A Retrospective
Search
Andrew Godwin
August 01, 2014
Programming
2
290
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
Reconciling Everything
andrewgodwin
1
250
Django Through The Years
andrewgodwin
0
150
Writing Maintainable Software At Scale
andrewgodwin
0
380
A Newcomer's Guide To Airflow's Architecture
andrewgodwin
0
300
Async, Python, and the Future
andrewgodwin
2
590
How To Break Django: With Async
andrewgodwin
1
650
Taking Django's ORM Async
andrewgodwin
0
660
The Long Road To Asynchrony
andrewgodwin
0
580
The Scientist & The Engineer
andrewgodwin
1
680
Other Decks in Programming
See All in Programming
CSC509 Lecture 09
javiergs
PRO
0
140
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
100
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
250
as(型アサーション)を書く前にできること
marokanatani
9
2.6k
Remix on Hono on Cloudflare Workers
yusukebe
1
280
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
170
Outline View in SwiftUI
1024jp
1
320
役立つログに取り組もう
irof
28
9.6k
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
10
1.3k
Quine, Polyglot, 良いコード
qnighy
4
640
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
52
13k
It's Worth the Effort
3n
183
27k
The Cult of Friendly URLs
andyhume
78
6k
How GitHub (no longer) Works
holman
310
140k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
A designer walks into a library…
pauljervisheath
203
24k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
How STYLIGHT went responsive
nonsquared
95
5.2k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
BBQ
matthewcrist
85
9.3k
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
[email protected]