How to drop all tables from the database with manage.py CLI in Django?

前端 未结 18 1738
余生分开走
余生分开走 2020-11-29 16:54

How can I drop all tables from a database using manage.py and command line? Is there any way to do that executing manage.py with appropriate parameters so I can execute it f

18条回答
  •  情书的邮戳
    2020-11-29 17:48

    python manage.py migrate zero

    sqlclear was removed from 1.9.

    Release notes mention that it is due to the introduction of migrations: https://docs.djangoproject.com/en/1.9/releases/1.9/

    Unfortunately I could not find a method that works on all apps at once, nor a built-in way to list all installed apps from the admin: How to list all installed apps with manage.py in Django?

    Related: How to reset migrations in Django 1.7?

提交回复
热议问题