简体   繁体   中英

Delete model and DB table in Django with migrations

I have two models: Clause and Template , they have been migrated locally, but I want to delete one of them. The question is: If I just delete it from models.py and admin.py, and run makemigration and migrate, how can I delete and the related DB table as well? Should I delete DB table manualy or the migrations will delete it?

If you delete one or more from the models.py they will be deleted also in the DB.

The makemigration resets the DB and the migrate command will confirm it.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM