In This Article you will learn how you can create migrations in Django
, at this stage we are assuming that you have already created the models , you can follow tutorial about Django Tutorial : Creating Django Models (models.py)
With the model created, the first thing you need to do is create a migration for it, migration will create your database tables,You can do this with the following command in pycharm/terminal:
python manage.py makemigrations
This creates the migrations file that instructs Django on how to create the database tables for the models defined in your application.
As you will also see, the migrations directory now contains a new file: 0001_initial.py in project folder.
Next is Applying Migrations
You have now created the migration, but to actually make any changes in the database, you have to apply it with the management command migrate.
In Terminal run this command:
$ python manage.py migrate
Now there are multiple tables. Their names give you an idea of their purpose.