【发布时间】:2018-01-28 16:35:35
【问题描述】:
我更改了模型并进行了迁移。然后我再次更改了我的模型,当尝试 python manage.py migrate 时出现错误:
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions, shop
Running migrations:
Applying shop.0004_auto_20180128_1331...Traceback (most recent call last):
File "/home/morilon/dj/intshop/venv/lib/python3.6/site-packages/django/db/backends/utils.py", line 83, in _execute
return self.cursor.execute(sql)
File "/home/morilon/dj/intshop/venv/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 301, in execute
return Database.Cursor.execute(self, query)
sqlite3.OperationalError: table "shop_brand" already exists
所以我的问题是 - 我怎样才能删除表“shop_brand”???
我已经尝试过flush 和sqlflush,但这只是从表中删除数据,而不是实际表“shop_brand”。
我使用 django 2.0.1 和 python 3.6
【问题讨论】:
-
查看this
-
只是删除所有文件是一种选择,但我想知道如何只删除数据库中的一个平板电脑。
标签: django database sql-delete