So during migration I ran into an error saying I don't have a certain column. I've revised my code but I keep getting the same error and realized that I need to drop the database itself (tried deleting all migrations files except init.py). But I can't figure out how.
FYI, the project name is mvp
, and the app where the problem occurred is qanda
. I want to preserve the db in other apps in my project.
HOW DO I DROP A SPECIFIC DATABASE? Thank you very much.
Probably late to the party but you can change the db name in your settings file then makemigrations & migrate again...for a clean slate. I used to do that when uncertain of the changes impact in my test environment. DATABASES = {'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'NewDatabeseName', # the rest of the config here... } }
At a later stage you can go in and cleanup the unused db(s)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.