sqlmigrate and Inspecting SQL
See the raw SQL a migration will run.
See the Real SQL
Migrations are Python, but the database speaks SQL. The sqlmigrate command shows the exact SQL a migration will run.
How to Run It
Give sqlmigrate an app label and a migration number, and it prints the SQL without applying anything.
python manage.py sqlmigrate blog 0002All lessons in this course
- makemigrations vs migrate
- Reading a Migration File
- Changing a Model and Re-migrating
- sqlmigrate and Inspecting SQL