python manage.py makemigrations给出没有检测到变化?

时间:2022-12-12 18:04:50

I just clone exiting project from github, and dump mysql database in my local machine. Every thing is working fine. I made some changes in myapp/model.py, like add new tables. After that when run
1. python ./manage.py makemigrations myapp. Then it makes migration files like

我只是从github克隆退出项目,并在我的本地机器中转储mysql数据库。一切都很好。我在myapp / model.py中做了一些更改,比如添加新表。之后运行1. python ./manage.py makemigrations myapp。然后它使迁移文件像

Migrations for 'myapp':
  0001_initial.py:
    - Create model AndroidRegkey
    - Create model ApkVersion
     ....................... 
     .......................
  1. python manage.py migrate myapp it gives following message

    python manage.py迁移myapp它给出了以下消息

    Operations to perform:
      Apply all migrations: myapp
    Running migrations:
      No migrations to apply.
    

This is the first time migration on my local machine. I already have database. But after Adding new models in model.py first time it does not apply any migration to data base, why?

这是我第一次在本地计算机上迁移。我已经有了数据库。但是在第一次在model.py中添加新模型后,它没有应用任何迁移到数据库,为什么?

I also go this link stack-over flow but not working.

我也去了这个链接堆栈流但不工作。

When I ran python manage.py migrate --list Getting following result.

当我运行python manage.py migrate --list获得以下结果。

admin
 [X] 0001_initial
auth
 [X] 0001_initial
contenttypes
 [X] 0001_initial
intracity
 (no migrations)
mailer
 [X] 0001_initial
 [X] 0002_auto_20150720_1433
sessions
 [X] 0001_initial

1 个解决方案

#1


2  

When you apply migrations, the migrations that have been applied are stored in the database. They will also be exported to your database dump. So your database should already be in the correct state after you import the data locally. Django looks at the relevant table, sees you're up to date, and takes no further action.

应用迁移时,已应用的迁移将存储在数据库中。它们也将导出到您的数据库转储中。因此,在本地导入数据后,您的数据库应该已处于正确的状态。 Django查看相关表格,看到您是最新的,并且不采取进一步行动。

#1


2  

When you apply migrations, the migrations that have been applied are stored in the database. They will also be exported to your database dump. So your database should already be in the correct state after you import the data locally. Django looks at the relevant table, sees you're up to date, and takes no further action.

应用迁移时,已应用的迁移将存储在数据库中。它们也将导出到您的数据库转储中。因此,在本地导入数据后,您的数据库应该已处于正确的状态。 Django查看相关表格,看到您是最新的,并且不采取进一步行动。