DEV Community

Cover image for How to Delete a Table from a Database in Django

Posted on

How to Delete a Table from a Database in Django

Solution Link


How to delete a single table in Django 4.0:

  1. Remove <YourDeleteTable> model from file
  2. Remove <YourDeleteTable> class from file and ALL other instances of wherever this class is used.
  3. python makemigrations <<your app>>
  4. python migrate


I wrote this guide because I lost all my data from following a different guide on Stack Overflow. T_T

Solutions to Additional Database Problems in Django

Top comments (2)

sloan profile image
Sloan the DEV Moderator

Hi there, we encourage authors to share their entire posts here on DEV, rather than mostly pointing to an external link. Doing so helps ensure that readers don’t have to jump around to too many different pages, and it helps focus the conversation right here in the comments section.

If you choose to do so, you also have the option to add a canonical URL directly to your post.

tieje profile image

Will do