From the course: Learning Django
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Django migrations
- [Instructor] While the Django models define the expected structure of our database, migrations are responsible for creating the necessary scripts to change this structure through time as we update our code to change our models. There are several cases in which a migration is needed. When a new model is created, a migration creates the corresponding database table. Migrations are also needed when a field is added or removed from an existing model, or, when attributes of a field have changed. All of these changes to a model's file need a corresponding change to the database, and for these purposes migrations need to be created, and then run. The first migration created for a new Django app will create tables for the models that are defined. These migrations are called initial migrations. We've defined models for our app, but we have yet to create these initial migrations and we'll tackle this in a moment. The commands…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Models, routing, views, and templates3m 55s
-
(Locked)
Django models1m 19s
-
(Locked)
Django fields3m 46s
-
(Locked)
Implement model and fields5m 24s
-
(Locked)
Django migrations6m 5s
-
(Locked)
Import CSV data6m 24s
-
(Locked)
Work with the Django admin7m 18s
-
(Locked)
Query data with the Django ORM6m 42s
-
-
-
-