Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

What Django Migrations Are and the Problems They Solve

Give Feedback

This video will introduce django migrations and give you an overview of what you’ll learn throughout the course. You will learn what migrations are, the advantages of using them, and how django works with relational databases.

00:01 Hello! I’m Darren from Real Python and welcome to this video where you’re going to take a look at Django migrations. You’re going to see what migrations are and the problems that they solve.

00:11 You’re going to see how to create migrations, how to apply the migrations you’ve created, how to change your Django models, how to list migrations, how to unapply migrations, and how to name those migrations.

00:27 First, let’s take a look at what migrations are and the problems that they solve.

00:32 So, what are migrations? Django is designed to work with a relational database. It makes it easy to program websites which have a database at their core.

00:43 Examples of our database would be things such as MySQL, PostgreSQL, or SQLite. Django uses an object-relational mapper, an ORM, to map the database to Python code.

00:54 This means you don’t have to learn SQL to create databases and Django translates the Python classes that you create into the database for you. Migrations are the tools which allow the creation and modification of database tables without having to learn that SQL language.

01:14 So, what are the advantages of using migrations? Well, the first one is to avoid repetition. You’re not creating similar code to create your models within your program and then doing the same to create it in the database. Secondly, closely related to this, it ensures that the model and the database are in sync.

01:33 Third, it’s possible to track the database schema changes because these are reflected in your Python code rather than merely in the database files themselves. And fourth, the modification of the databases are handled for you.

01:46 Django creates the migrations for you, allowing these changes to be quick and painless.

xiangqingbu on March 28, 2020

this video was failed to be connected.

Martin Breuss RP Team on March 28, 2020

Hi @xiangqungbu, this is probably due to an internet provider blocking our video hosting service. Try accessing the page through a VPN. E.g. Opera browser has a built-in VPN.

Become a Member to join the conversation.