Tips for Naming Django Migrations
Django gives names to migrations based on the timestamp. In this lesson, you’ll see how to alter this behaviour by using the --name
switch to give your migrations custom names.
00:01 Next, you’ll see how to name your migrations. With the previous example, Django came up with a name automatically based on the timestamp. You can see it here.
00:16
However, this isn’t very descriptive, and naming your migrations will be well worth the extra few keystrokes of adding the --name
switch to the end of the command.
00:26
Firstly, remove the unapplied migration, and now use makemigrations
00:40
with the --name
switch added and a descriptive name.
00:54 The migration file is named much more sensibly now and will make a lot more sense in the future when you look back at it.
Become a Member to join the conversation.
Romain BOBOE on June 3, 2020
Short and effective. Thanks fort this lessons