DEV Community

loading...

Discussion on: Writing a Django Data Migration with Real World Example

Collapse
sobolevn profile image
Nikita Sobolev

Don't forget to test your data migrations! One can use django-test-migrations package for this:

GitHub logo wemake-services / django-test-migrations

Test django schema and data migrations, including migrations' order

django-test-migrations

wemake.services Build Status Coverage Python Version wemake-python-styleguide

Features

  • Allows to test django schema and data migrations
  • Allows to test both forward and rollback migrations
  • Allows to test the migrations order
  • Allows to test migration names
  • Fully typed with annotations and checked with mypy, PEP561 compatible
  • Easy to start: has lots of docs, tests, and tutorials

Read the announcing post See real-world usage example.

Installation

pip install django-test-migrations

We support several django versions:

  • 1.11
  • 2.1
  • 2.2

Other versions might work too, but they are not officially supported.

Testing django migrations

Testing migrations is not a frequent thing in django land But, sometimes it is totally required. When?

When we do complex schema or data changes and what to be sure that existing data won't be corrupted We might also want to be sure that all migrations can be safely rolled back And as a final touch we want to be sure that migrations are…

Collapse
guin profile image
Angelika Jarosz Author

Thanks! Will definitely look into this package when i get a chance!