Django迁移
1 2 3 4 5 6 7 8 9
| python manage.py makemigrations
python manage.py makemigrations --empty appname
python manage.py makemigrations app_name
python manage.py migrate
python manage.py migrate app_name
|
如果想要精确到某个迁移文件(0004_xxx.py):
1
| python manage.py migrate app_name 0004
|
如果想看迁移文件的执行状态,可以用showmigrations命令查看:
显示django已知的migrations和状态。
1 2 3 4 5 6
| $ python manage.py showmigrations admin [X] 0001_initial auth [X] 0001_initial [X] 0002_alter_permission_name_max_length
|
Django中表变跟新后migrate无效的问题
解决方案
1 2 3 4 5 6 7 8
|
python manage.py dbshell
delete from django_migrations where app='your_appname';
python manage.py migrate
|