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
260
Django Through The Years
andrewgodwin
0
160
Writing Maintainable Software At Scale
andrewgodwin
0
390
A Newcomer's Guide To Airflow's Architecture
andrewgodwin
0
310
Async, Python, and the Future
andrewgodwin
2
610
How To Break Django: With Async
andrewgodwin
1
660
Taking Django's ORM Async
andrewgodwin
0
670
The Long Road To Asynchrony
andrewgodwin
0
590
The Scientist & The Engineer
andrewgodwin
1
690
Other Decks in Programming
See All in Programming
良いユニットテストを書こう
mototakatsu
4
1.5k
わたしの星のままで一番星になる ~ 出産を機にSIerからEC事業会社に転職した話 ~
kimura_m_29
0
180
Semantic Kernelのネイティブプラグインで知識拡張をしてみる
tomokusaba
0
180
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
600
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
130
17年周年のWebアプリケーションにTanStack Queryを導入する / Implementing TanStack Query in a 17th Anniversary Web Application
saitolume
0
250
Go の GC の不得意な部分を克服したい
taiyow
2
760
return文におけるstd::moveについて
onihusube
1
610
Discord Bot with AI -for English learners-
xin9le
1
120
htmxって知っていますか?次世代のHTML
hiro_ghap1
0
330
Full stack testing :: basic to basic
up1
1
930
create_tableをしただけなのに〜囚われのuuid編〜
daisukeshinoku
0
240
Featured
See All Featured
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
How to Ace a Technical Interview
jacobian
276
23k
GraphQLとの向き合い方2022年版
quramy
44
13k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Building an army of robots
kneath
302
44k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Six Lessons from altMBA
skipperchong
27
3.5k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
Making the Leap to Tech Lead
cromwellryan
133
9k
Documentation Writing (for coders)
carmenintech
66
4.5k
Testing 201, or: Great Expectations
jmmastey
40
7.1k
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]