Django Database Migration - Python Web Development!

Publicado el: 13 julio 2021
en el canal de: codevev
2,408
62

#Python #Shorts

In the last video we explored how we can define Django models inside models.py file to represent tables and columns in the database. But right now we don't even have a database because we never created it.

Whenever you're using an ORM, the process of creating the database and applying changes to it, or just applying additional changes if it was already created, is known as a database migration.

The migration consists of two steps. First, creating an actual migration, which we can do by running "python manage.py makemigrations". It will create a file with the instructions of what changes to apply. If you get "No changes detected", try running "python manage.py makemigrations yourappname".

And the second step is the actual migration, which is done by running "python manage.py migrate". This will create the database and all the tables and columns defined in our models.py file.

And if you look into your Django project folder now, you should see a new sqlite database being created.
-------------------------------------------------------------------------------------
Links:
Blog: https://evgenyurubkov.com
Twitter:   / evgenyurubkov  
Instagram:   / evgenyurubkov  
Youtube:    / @codevev  


En esta página del sitio puede ver el video en línea Django Database Migration - Python Web Development! de Duración hora minuto segunda en buena calidad , que subió el usuario codevev 13 julio 2021, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 2,408 veces y le gustó 62 a los espectadores. Disfruta viendo!