LoginSignup
0
0

More than 1 year has passed since last update.

django table "XXX" already exists エラー解決

Posted at

エラー内容

django.db.utils.OperationalError: table "XXX" already exists
"XXX" DBテーブルが既に存在するため、エラーが発生している。
DBのテーブルを削除することでエラーが解決する

DB表示

python manage.py dbshell

テーブルを表示

sqlite> .tables

XXXテーブルを削除

drop table XXX;

補足

DBのコマンドラインからの抜け方

sqlite> .exit   #正しい抜け方

下記コマンドでエラーが解決したか確認

python manage.py makemigrations
python manage.py migrate
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0