Slide 1

Slide 1 text

Andrew Godwin @andrewgodwin Migrating THE Future

Slide 2

Slide 2 text

Andrew Godwin Django core developer South author Database Wrangler

Slide 3

Slide 3 text

South

Slide 4

Slide 4 text

South django.db.migrations

Slide 5

Slide 5 text

South django.db.migrations Kickstarter

Slide 6

Slide 6 text

£2,500

Slide 7

Slide 7 text

£2,500 Raised!

Slide 8

Slide 8 text

£2,500 Raised! 65 minutes in.

Slide 9

Slide 9 text

£17,952 From 502 backers

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

Tom Christie Alex Gaynor Pixtape.com Ulrich Petri (@ulope) Sam Wilson Dan Fairs Nyaruka Ltd Jorge Bastida Aaron Bassett Stefan Foulis Aymeric Augustin Rich Leland Ray Schamp CookDrop Inc. fitclipboard.com Type/Code Bruno Renié Bryan Veloso Smashing Ideas John P. Neumann Filipe Regadas Simon Law (sfllaw@sfllaw.ca) Ryan Kaskel CYeong Baptiste Mispelon Eric Florenzano Albert O'Connor, Web Developer Jeremy Dunck Daniel Lindsley Dan Cundiff Automatique another one GmbH Vincent Driessen (@nvie) Daniel Greenfeld Joey Wilhelm Marek Stępniowski Sil Westerveld (SURFsara) http://Scal.io RMSA - the makers of Fresco Nitty Gritty Software, LLC Greg Aker Christopher Dickes SJM Steffann Messiah Studio (New Zealand) Dirty Monkey Łukasz Langa (ambv) Dougal Matthews Joel Crocker

Slide 12

Slide 12 text

Aaron Bassett Aaron Ho Aaron Larner Aaron Malone Adam Connor Adam Fast Adam Foster Adam Gross Adam Joseph Cook Adam Rich Adrian Espinosa Adrian Rego Adrian Smith Agostino Albert O'Connor Alec Perkins Ales Alexander Rudakov Alexandre Lessard Alexey Sveshnikov Alex Gaynor Alex Hung Alex Louden Alex Tziallas Alex Yuzhakov Alfredo Aguirre Ames Cornish Anatoly Popov Andreas Louca Andreas Madsack Andreas Rieger André Simões Andrew Austin Andrew Dunn Andrew Gorcester Andrew Jesaitis Andrzej Voss Andy Baker Andy Dirnberger Angel Freire Anselm Lingnau Arild Martin Møller Haugstad Arnaud Art van Scheppingen Athanassios Diacakis August Bigelow Aymeric Augustin Backer Name Backer Name Backer Name Backer Name Backer Name Backer Name Backer Name Backer Name Baldur Þór Emilsson Baptiste Millou Baptiste Mispelon Barbara Shaurette Bayo opadeyi Ben Ben Firshman Ben Graham Benjamin Wohlwend Ben Lopatin Ben Spaulding BeProud Bernhard Janetzki bitprophet Bob Barcklay Bob Haugen Bob Lozano Bolster Boris Chervenkov Bouke Haarsma Bozidar Benko Brad Montgomery Brad Wright Brandon Bennett Brandon Konkle Brett Epps Brian O'Dell Brian Reigle Brian Rosner Brian Wisti Bruno Renié Bruno Tikami Bryan Koroleski Bryan Veloso Carl Meyer Carlos Ribeiro Carny Cheng Casper S. Jensen Chad Catlett Chris Adams Chris Beaven Chris Drackett Chris Johnston Chris Kleinknecht Chris Streeter Christian Bertschy Christian Lange Christian Toivola Christian Treutler Christophe Pettus Christopher Dickes Christopher Grebs Christopher J. Hasenpflug Christopher Reeves Christoph Heer Chris Vigelius "Chris ""Wraithan"" McDonald" Cícero Raupp Rolim Claes Ström Colin Woods Cuauhtemoc Ramirez Damon Ciarelli Dan Cundiff DanEE Dan Fairs Daniel Gagnon Daniel Greenfeld Daniel Lindsley Daniel Perry Daniel Watkins Danilo Dan Koch Dan Langer Danny Roa Dan Tyan Darian Moody Dave Arter Dave Masse David David Cramer David Feinzeig David Grant David Jeffrey David Novák David Sinsky Denis Darii Dennis Seymour Derek Leverenz Deric Crago Devin Hunt Dj Gilcrease Dmitriy Narkevich Dong Hee Kim Dougal Matthews Doug Tabacco Dustin Davis Edgars Jēkabsons Elliot Murphy Enrico Berti Ensorceled Eric Eric Florenzano Ernesto Rico-Schmidt Esa Evan Culver Ezequiel Pochiero Federico Giordano Felipe Coury Felipe Kellermann Felix Yuan Fernando Gutierrez Fernando Rocha Filipe Regadas Filipp Lepalaan Florian Apolloner fm 10.4 Frederik De Bleser Fusionbox Gabriel Gamil Gabriel Grant g chow George Hickman Gert Van Gool Giles Thomas Giovanni Totaro Graham Ullrich Greg Aker Guilherme Gondim Håkon Erichsen Hans Lawrenz harijay Herbert Poul Horst Gutmann Hrishikesh Ballal Hugo Rodger-Brown Hugo Wang Ian Ildar Samit Ivan Habunek Iván Raskovsky Ivan Yurchenko Ivo Teel Jacek Jacob Briggs Jacob Kaplan-Moss Jaime Irurzun Jakub Wiśniowski James Cleveland James Johnson James Robert James Tiplady James Walker Jamie Wilson Jannis Leidel Jason Jason Cartwright Jason Mayfield Jason Simeone Jasper den Hertog Javed Khan Jeff jens quade Jérémie Blaser Jeremy Cantrell Jeremy Dunck Jeremy Keeshin Jesse Michelsen Jesus Noland Jim Ray Jirka Vejrazka JMatt Peterson João Oliveira Joel Crocker Joel Shapiro Joel Squire Joey Castillo Joey Leingang Joey Wilhelm John Paulett John P. Neumann John Sykora John Wegis Jonas Nockert Jonathan Biddle Jonathan Morgan Jon Danao Jon Fedyk Joonathan Mägi Jorge Bastida Jorge Camargo Jörg Kreß Jose Padilla Joseph Wenninger Josh Ourisman Josh Steiner Joshua Blount Joshua Johanan Josh Wright Julen Ruiz Aizpuru Julian Wachholz Julio Oña Julius Welby Jure Ham Kalle Karjalainen Katie Cunningham Katsumi Honda Keith Gray Kenneth Love Kenneth Reitz Kirill Sibirev Kiwi Koh Chuan Yeong kortina Kura Kuratko Lachlan Musicman Larry Hamel Larry Osborn Lars Wikman Laust M. Ladefoged Leo Leo Hourvitz Leonidas Tsementzis Leon Matthews Leon Smith Le Thanh Duong Logit internet services Ltd. Loic Bistuer Lucas Eisenzimmer Łukasz Langa Luke Hatcher Maciej Konieczny Maciek Gryka Marc Egli Marcelo Alves Marcel Rudolph Marco Bonetti Marc Tamlyn Marek Olszewski Marek Stępniowski Margus Holland Marianne Marielle Volz Mark Hepburn Mark Hurley Mark Longair Mark Lyon Mark Ng Mark Norman Francis Marko Samastur Markus Zapke-Gründemann marteinn Martin Brochhaus Mathieu Fenniak Mathieu Meylan Mathieu Richardoz Matt Austin Matthew Tretter Mattias Linnap Matt Lenc Matt McGlincy Matt Stevens Matt Woodward Matus Moravcik Mauro Doglio Max Arnold Meir Kriheli Michael Blatherwick Michael Fogel Michael Gisi Michael Sandford Michael Twomey Miguel Pilar Mihael Konjević Mike Gallagher MIKe O'Toole Mirus Research Mitch Berkson Mladen Kovacevic moberley Nate Graves Nate Meyvis Nate Thelen Nephila Nick Albright Nick Siemsen Nicolas Perriault Nicolas Pottier Nicole Foster niels Niels Sandholt Busch Nikolai Prokoschenko Noah Kantrowitz Noemi notanumber Numan Sachwani numbsafari Nurzhan Bakibayev Ola Sitarska Oliver Beattie Oliver George Oliver Steele Omen Ondrej Slintak ORDOQUY Xavier Ori Oskar Jakieła Ousmane Wilane Parham Pascal Hartig Pathwright Press Patrick Arminio Patrick Craston Patrick Taylor Paul Bersch Paul Ebreo Paul Mattal Paul Medlock-Walton Peppe Bergqvist Peter Baumgartner + Lincoln Loop Peter Evans Peter Farrell Peter Hyben Peter Inglesby Peter Kropf Peter Sanchez Petr Marhoun Petr Timofeev Philip Kimmey Philipp Bosch Philipp Kruse Philipp Läubli Philipp Weidenhiller Philip Roche Pierre-Julien Grizel pmdhazy Preston Holmes Promeritum quinox Raj Jalan Ralph Ramji Srinivasan Ray Remco Wendt Renato Garcia Pedigoni Renato Oliveira riccardo magliocchetti Richard Beales Rich Leland Rinat Akhtamov Rishabh Manocha Rivo Laks RJ Walsh Rob Berwick Robert Medeiros Roberto Rosario Rod Afshar Rodrigo Chacon Rogelio Rolo Mawlabaux Ross Crawford-d'Heureuse Ross Duggan Russell Keith-Magee Ryan Kaskel Ryan McDevitt Ryan van Roode Sævar Öfjörð Magnússon Sahas Katta Sam Bull Sam Hartsfield Sam Johnson Sam Kitonyi Samuel Clay Samuel Linde Sander Steffann Sandor Weisz Sau Ramirez Scott Henley Scott Nixon Sean O'Connor Sean Powell Sebastian Brandt Sebastian Desimone Sebastian vetter Sebastian Wain seibert Senko Rašić Sergey Leschina Sergey Silaev Sergey Vilgelm Seth Burke Shawn Milochik Silvan Spross Sil Westerveld Simeon Franklin Simon Bernier simon hayward Simon Hewitt Simon Law Simon Pantzare Simon Willison Skirmantas Jurgaitis Solomon Matthews Sören Schlömer Stefan Foulis Stefano Delli Ponti Stein Magnus Jodal Stephan Huiser Stephen Steve Steve Holden Steve Jalim Sumit Chachraa Sungjoo Ha Sven Grunewaldt Taavi Taijala Takuya Tozawa Taymon Thijs van Dien Thomas Gruner Tijs Teulings Tim Carter Timothy Zwolak TinFoil Tom Christie Tom Dyson Tomek Paczkowski Tommy Gudmundsen Tom Usher Tony Hauber Tony Meyer Trevor Riles TrialReach Tuk Bredsdorff Tunde Ashafa Twidi Type/Code Ulrich Petri Valentin V. Bartenev Victor Allen Vidir Gudmundsson ViKing Ville Alatalo Vincent Driessen Visa Kopu Vitaliy Fuks Vladimir Volodymyr Hotsyk Wade Austin Walker Hamilton Warren Packard Wiley Kestner William Arnold William Hogan Williams Mendez Wil Linssen Yarden Michael Shem-Tov Yury Yurevich zaebee Павел Тявин

Slide 13

Slide 13 text

Why replace South?

Slide 14

Slide 14 text

5 years of learning Poor VCS branching Huge migration file size Migration sets get too large

Slide 15

Slide 15 text

The Future New! Exciting! 95% less migration noise!

Slide 16

Slide 16 text

django.db.migrations django.db.backends.schema

Slide 17

Slide 17 text

django.db.migrations Migration commands Autodetection Dependencies

Slide 18

Slide 18 text

django.db.backends.schema SQL generation Database abstraction

Slide 19

Slide 19 text

ed = connection.schema_editor() ed.start() ed.create_model(MyModel) ed.add_field(OtherModel, "foo", BooleanField()) ed.commit()

Slide 20

Slide 20 text

PostgreSQL MySQL SQLite Oracle MSSQL Yep! Hopefully! DB2 MongoDB Wait, what?

Slide 21

Slide 21 text

New migration format Finally! Please stop complaining now.

Slide 22

Slide 22 text

Old Format

Slide 23

Slide 23 text

Old Format Migration actions Frozen ORM

Slide 24

Slide 24 text

New Format

Slide 25

Slide 25 text

New Format

Slide 26

Slide 26 text

How? Create Model Page with fields content, date Create Model Author with fields name, age Add title to Page Remove age from Author Migration 1 Migration 2 Migration 3 Model Page with fields title, content, date Model Author with field name

Slide 27

Slide 27 text

Dependencies Better. Faster. Stronger. Not harder.

Slide 28

Slide 28 text

0001_initial Before 0002_ponies 0003_foo 0003_bar

Slide 29

Slide 29 text

0001_initial Now 0002_ponies 0003_foo 0003_bar

Slide 30

Slide 30 text

0001_initial Now 0002_ponies 0003_foo 0003_bar 0004_merge

Slide 31

Slide 31 text

Squashing Saves precious, precious bytes.

Slide 32

Slide 32 text

0001 0002 0003 0004 0005 0006

Slide 33

Slide 33 text

0001 0002 0003 0004 0005 0006 0005_alt

Slide 34

Slide 34 text

0006 0005_alt

Slide 35

Slide 35 text

0006 0001 0002 0003 0004 0005 0006 0001 0002 0003 0004 0005 APP A APP B

Slide 36

Slide 36 text

0006 0001 0002 0003 0004 0005 0006 0001 0002 0003 0004 0005 APP A APP B

Slide 37

Slide 37 text

How's it going? Kickstarter is funding so many holidays work days

Slide 38

Slide 38 text

Schema Backends Mostly done, ready for merge

Slide 39

Slide 39 text

Migration code Still going, most complex part

Slide 40

Slide 40 text

Field API changes Incoming. Watch django-developers if interested.

Slide 41

Slide 41 text

The Code https://github.com/andrewgodwin/ django/tree/schema-alteration/

Slide 42

Slide 42 text

Blog Posts aeracode.org/category/django-diaries/

Slide 43

Slide 43 text

Thoughts, feedback and fully- complete migration frameworks to: andrew@aeracode.org

Slide 44

Slide 44 text

Fin. Andrew Godwin Thank you. @andrewgodwin andrew@aeracode.org http://www.aeracode.org