Categories
Python Answers

How to revert the last migration with Python Django?

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *