Django - Change a ForeignKey relation to OneToOne

前端 未结 3 444
感动是毒
感动是毒 2021-02-07 07:44

I am using South with my Django app. I have two models that I am changing from having a ForeignKey relation to having a OneToOneField relation. When I

3条回答
  •  一生所求
    2021-02-07 08:06

    I agree with @e-satis that the goal here is to fake a migration, but I suggest a different approach if you're working with a team.

    If you create a migration then --fake it, all your team members will need to remember to --fake it as well. If any of them don't do this when they upgrade, you're in trouble.

    A better approach is to create an empty migration, then migrate it:

    manage.py schemamigration yourapp --empty fake_migration_of_foreign_key_to_onetoone
    manage.py migrate  # Like you always do! 
    

提交回复
热议问题