~/talk

Django migrations, friend or foe? Optimize them for testing

Talkat Django Day Copenhagen 2024 Β· on Friday, 2024-10-04Β· [databases, testing]
slides:none on file

Covers concrete Django commands (makemigrations, migrate, showmigrations, sqlmigrate) and measures effect on CI test time: a 20-app demo spends ~30s creating the test DB but only 1s running tests. Compares tactics: set MIGRATE=False (avoids migrations but adds ~5s model analysis), keepdb (saves ~20s locally but causes growing PKs and CI caching complexity), cdb (seed database) restores a dumped SQL file on CI and gives the best speed, while squashmigrations helps reviewability but only saves ~1s. Presents a custom CI seed DB implementation that took weeks to build and worked in production.

AI-written summary Β· about

  1. 0:00Introduction
  2. 1:08What are Django migrations
  3. 3:35Migration commands explained
  4. 6:07Modifying fields and models
  5. 8:00Custom migration code
  6. 10:12Fixtures and data loading
  7. 12:01Testing performance issues
  8. 13:53Optimizing test migrations
  9. 15:57External test databases
  10. 17:31Squashing migrations
  11. 21:48Cost of optimization
  12. 22:53Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark β€” the status bar button does the same
?
this help
esc
close this, then clear every filter β€” or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.