Django 1.8 - what's the difference between migrate and makemigrations?

后端 未结 8 753
说谎
说谎 2021-01-30 16:23

According to the documentation here: https://docs.djangoproject.com/en/1.8/topics/migrations/ it says:

migrate, which is responsible for applying migrations, as          


        
8条回答
  •  梦毁少年i
    2021-01-30 17:07

    It is necessary to run both the commands to complete the migration of the database tables to be in sync with your models.

    makemigrations simply analyzes your current models for any changes that would be out of sync with your database and creates a migrations file that can be used to bring the in sync. If left at this point, your models would still be out of sync with your database possibly breaking your code that queries the database.

    migrate is the command to "Make It So!" and apply the changes noted during the makemigrations phase.

    Source

提交回复
热议问题