Pau*_*ipp 7 django django-south
使用别人代码的分支,我添加了一个模型字段并进行了通常的自动迁移:
~ $ django_admin.py migrate mezzanine_slides --auto
You cannot use automatic detection, since the previous migration does not have this whole app frozen.
Either make migrations using '--freeze mezzanine_slides' or set 'SOUTH_AUTO_FREEZE_APP = True' in your settings.py.
Run Code Online (Sandbox Code Playgroud)
我尝试使用提示的明显选项无济于事,从文档中无处可去.
好的,有一些试验和错误:我创建了一个'冻结迁移',因此:
~ $ django_admin.py schemamigration --freeze mezzanine_slides mezzanine_slides freeze --empty
Created 0002_freeze.py. You must now edit this migration and add the code for each direction.
Run Code Online (Sandbox Code Playgroud)
然后我编辑了生成的迁移并删除了我添加的字段,以便:
! $ django_admin.py schemamigration mezzanine_slides --auto
+ Added field caption on mezzanine_slides.Slide
Created 0003_auto__add_field_slide_caption.py. You can now apply this migration with: ./manage.py migrate mezzanine_slides
Run Code Online (Sandbox Code Playgroud)
完成后,迁移工作正常.