~/talk

Django migrations, friend or foe? Optimize your Django migrations for faster testing

Talkat DjangoCon US 2023 · 2023-10-16..10-20· [testing, developer-experience]
slides:none on file

Django commands used: makemigrations, migrate, showmigrations, sqlmigrate, squashmigrations and migrate --prune; config knobs: KEEPDB and setting MIGRATE=False. Claim: hundreds of tiny migrations slow test DB creation (tests 1s, DB create ~20s → ~21s). Squashing alone keeps DB create ~20s. Recreating migrations from scratch yields DB create ~5s and total ~6s. Built a sample repo with branches, required manual porting for custom SQL/initial-data, and careful handling of circular dependencies and fixtures.

AI-written summary · about

  1. 0:00Django migrations intro
  2. 3:58How migrations work
  3. 7:08Migration complexity in dev
  4. 10:25Performance issues with test database creation
  5. 12:15Faster test DB setup
  6. 13:58Squashing limits
  7. 17:55Squashing in Django 4.1
  8. 19:44Recreate migrations
  9. 23:22Optimization results
  10. 23:45Q&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.