How to Delete a Table from a Database in Django

tieje

tieje

Posted on April 4, 2022

How to Delete a Table from a Database in Django

Solution Link

Solution

How to delete a single table in Django 4.0:

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

Background

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

💖 💪 🙅 🚩
tieje
tieje

Posted on April 4, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related