10.4 Schema Migrations
Creating data migrations are a nice introduction to migrations, but they may be a little too simplistic, mainly because they always rely on a single operation: RunPython. Django offers 15 others, and while we won’t have the opportunity to see all of them, we are now forced to use some of them to fix a few problems our site has.
When creating NewsLinkUpdate (Chapter 9, Section 9.3.2) and NewsLinkDelete (Chapter 9, Section 9.4.2) we discovered that we needed a unique way to identify NewsLink objects. At the moment, we’re using the primary key of each instance, a practice that is frowned upon because it leads to human-unfriendly URLs. Building NewsLink without a SlugField was thus (intentionally) a mistake that we need to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access