How to Create an Index in Django Without Downtime
All you need to know to implement graceful migrations in Django
If you maintain a Django site with a decent traffic, you probably need to deal with graceful migrations. With the help of the Real Python team, I wrote an article about one the most common problems in Django migrations: How to create an index without causing downtime.
In the article I explain what atomic and reversible migrations are, how to execute “raw” SQL in migrations the right way, and how using a little known migration command called
SeparateDatabaseAndState, you can completely alter the Django migrations built-in behavior.