Django Database Migration - Python Web Development!

Veröffentlicht am: 13 Juli 2021
auf dem Kanal: 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  


Auf dieser Seite können Sie das Online-Video Django Database Migration - Python Web Development! mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer codevev 13 Juli 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 2,408 Mal angesehen und es wurde von 62 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!