Menu Close

How to revert the last migration with Python Django?

Sometimes, we want to revert the last migration with Python Django.

In this article, we’ll look at how to revert the last migration with Python Django.

How to revert the last migration with Python Django?

To revert the last migration with Python Django, we can use the migrate command.

For instance, if we have migrations

  • 0010_previous_migration
  • 0011_migration_to_revert

Then we run

./manage.py migrate my_app 0010_previous_migration 

to revert our database back to the state when 0010_previous_migration was run.

Conclusion

To revert the last migration with Python Django, we can use the migrate command.

Posted in Python, Python Answers