So i was using MySQL as database backend engine, and after changing it back to SQLite i can't make migrations. Tried removing migrations, and db.sqlite3 file but it's still not working. Console is showing me that error
django.db.utils.OperationalError: no such table: books_api_book
Old
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': config.get("NAME"),
'HOST': config.get("HOST"),
'PORT': '3306',
'USER': config.get("USER"),
'PASSWORD': config.get("PASSWORD")
}
}
New
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / "db.sqlite3",
}
}
CodePudding user response:
What the command shows?
python manage.py showmigrations
CodePudding user response:
I think you should try removing the files that are in your folder migration except __init__.py
.
After that run :
py manage.py makemigrations
CodePudding user response:
if there is an sqlite in your project directory then delete it. inside your migrations folder delete everything except init.py. and run python manage.py makemigrations AppName and then migrate.
I hope that help