[Fixed]-How to make sure Django models match the database schema

27👍

To get a diff between your model definitions and the actual database fields you could take a look at django-extensions

Especially ./manage.py sqldiff

Django command that scans all models
for the given appnames and compares
there database schema with the real
database tables.

It indicates how columns in the
database are different from the SQL
that would be generated by Django.
This command is not a database
migration tool. Though it might
certainly be of help during
migrations. It’s purpose is to show
the current differences as a way to
checking or debugging your models
compared to the real database tables
and columns.

👤arie

Leave a comment