Django: When to run makemigrations?

后端 未结 2 1027
孤街浪徒
孤街浪徒 2021-02-15 11:06

In addition to adding/deleting/modifying field to model, Django also detects changes when I add or modify methods to the model.

So my question is should I run make

2条回答
  •  一个人的身影
    2021-02-15 12:05

    First of all,

    ./manage makemigrations

    will create (migration_number).py files in your app migrations folders. These lines of code are nothing but statements which help in creating actual fields in your respective database similar to SQL statements.

    In order to execute the migration which was created using the previous command, we will run the following command,

    ./manage.py migrate

    On migrate your new model fields will be reflected in database if there are no errors

提交回复
热议问题