Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Migrations | Models, datatypes, and fields
Django ORM Ninja: Técnicas Avanzadas para Desarrolladores
course content

Contenido del Curso

Django ORM Ninja: Técnicas Avanzadas para Desarrolladores

Django ORM Ninja: Técnicas Avanzadas para Desarrolladores

1. Introduction to Django ORM
2. Models, datatypes, and fields
3. Queries
4. Relations
5. Complex Queries
6. Advanced

book
Migrations

What are migrations? Migrations are looking for changes in the schema of the database. A schema is a set of tables. Django ORM uses the 'Code First' approach, meaning we first change the code, and then migrations help update the database state to match the code. Currently, we don’t have a database set up; we only have the code for our models.

Let’s start with this command:

Here, db is the application for which we are creating migrations. Now, we have two new files: the db.sqlite3 file and 0001_initial.py in the migrations folder. The db.sqlite3 file is not yet functional.

Executing python manage.py migrate will complete all operations written in the 0001_initial.py file. After running this command, we should see various messages indicating the progress.

1. What is the primary purpose of migrations in Django?
2. What does the 'Code First' approach in Django ORM imply?
3. What does the command 'python manage.py makemigrations db' do?
4. What is created as a result of running 'python manage.py makemigrations db'?
5. What is the purpose of the 'python manage.py migrate' command?
What is the primary purpose of migrations in Django?

What is the primary purpose of migrations in Django?

Selecciona la respuesta correcta

What does the 'Code First' approach in Django ORM imply?

What does the 'Code First' approach in Django ORM imply?

Selecciona la respuesta correcta

What does the command 'python manage.py makemigrations db' do?

What does the command 'python manage.py makemigrations db' do?

Selecciona la respuesta correcta

What is created as a result of running 'python manage.py makemigrations db'?

What is created as a result of running 'python manage.py makemigrations db'?

Selecciona la respuesta correcta

What is the purpose of the 'python manage.py migrate' command?

What is the purpose of the 'python manage.py migrate' command?

Selecciona la respuesta correcta

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 4
We're sorry to hear that something went wrong. What happened?
some-alt