Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Clean up unused database tables after removing a Django app?

When I remove a Django app from my list of INSTALLED_APPS, it doesn’t get rid of the old database tables; running ./manage.py makemigrations doesn’t detect any changes.

Apart from going into the database myself and dropping the old tables, is there a better way to clean up unused tables after uninstalling an app from my Django project?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can use migrate command by specifying a zero for this purpose.
Example-

$ python manage.py migrate appName zero

This will safely revert the database tables.

Relevant Doc

After running the zero migration, you may remove the app from INSTALLED_APPS

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading