Best Practices for migrations

Hi!

I’m looking for some best practices for running migrations in Django. What I’m used to using is having Post/Pre migrations to be able to release without downtime and not creating multiple releases.

For example, I need to add a field preferred_payment_method to User and default it to card. I’d have the migrations and deploy flow:

  1. Run migrations marked Pre on current code to add preferred_payment_method to User and set it to default card.
  2. Deploy and switch to new code
  3. Run migrations marked Post to remove the default in database and use the django model instead since that is django best practice

How do I achieve this in one release of my Django application?