Django: Getting Started Transcripts
Chapter: DB Migrations
Lecture: Chapter review
0:00 Look at that an entire chapter without any new code. to test. You can take the day off, you deserve it. Let's review the chapter.
0:10 Django provides ways of tracking what changes you've made to your models and provides commands to help you keep the database in sync.
0:18 Migration scripts are created by the make migrations command and live in the migrations directory under each app.
0:24 The scripts themselves are Python and contain a class that specifies what is to be done to the database.
0:31 Although the scripts are created automatically, they are just Python. The migrate command reads them in and builds the objects and
0:39 uses those to do the migration. This means you can modify them on your own and although not covered here.
0:46 There are even hooks for your own data migration management functions. You can do other things to the database on the entry point or exit point of
0:53 a script. You saw how the migrate command can take a specific script as a parameter and thus moved any point in the migration history.
1:02 Both forwards and backwards. Of course, if your script deleted a column, the data doesn't magically reappear, but the column will be restored.
1:11 In addition to all this, you learned some new management commands including show migrations and
1:16 ask you all migrate that gives you detailed information about what Django is doing for you. One last thing before I close up a tiny bit of history.
1:26 This migration stuff is a newer feature of Django and the functionality used to be part of a separate library called South.
1:33 So if you happen to be digging around in some old code and you see South
1:36 migration scripts, those were the inspiration for what is now included in the library.
1:42 You're getting closer and closer to being able to manage a production Django instance.
1:46 In the next chapter, I'll talk about some considerations when it comes to deployment.