I changed my models and made migrations. Then i changed my models another one time and when try python manage.py migrate i get error:
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
So my question is - how can i delete table "shop_brand"???
I already tried flush
and sqlflush
but that only delete data from table but not actually table "shop_brand".
I use django 2.0.1 and python 3.6
Use the dbshell command
python manage.py dbshell
then while in the shell, depending on what database you are using, you type the command to show tables to identify the table you want to drop.
For instance, for sqlite, you would use
.tables
still in the shell, you can use SQL command to drop the table
DROP TABLE shop_brand;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With