【问题标题】:How do I reset a django app and start clean both with south migrations and in the database?如何重置 django 应用程序并开始清理南迁移和数据库?
【发布时间】:2015-07-10 18:48:40
【问题描述】:

我需要一种方法,只需在应用程序上点击“重置”即可进行南迁移和数据库。

有什么好的方法可以做到这一点?

【问题讨论】:

    标签: django postgresql django-south


    【解决方案1】:

    手动操作并不难:

    $ python manage.py sqlclear myapp
    

    将为您提供 SQL 命令来擦除您当前的应用程序表 - 您可能希望列出以应用程序名称开头的所有表以查看旧表(如果有的话)。

    South 将其迁移历史存储在另一个数据库表中,因此您应该能够使用以下 SQL 命令杀死它们:

    DELETE FROM south_migrationhistory WHERE app_name = 'myapp';
    

    【讨论】:

      猜你喜欢
      • 2013-05-23
      • 2014-07-30
      • 2014-06-22
      • 2012-06-14
      • 2014-12-04
      • 2013-05-05
      • 2018-09-27
      • 1970-01-01
      • 2014-05-02
      相关资源
      最近更新 更多