Is it safe to rename Django migrations file?

This works, with a minor caveat: Django will no longer know that the renamed migration is applied.

So the steps to renaming a migration are:

  1. Rename the file.
  2. Repoint any dependencies to the new file.
  3. If the renamed migration was already applied, apply it again using --fake.

If it’s a brand new migration, 2 and 3 won’t apply, and it’s perfectly fine to rename them.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)