South Rollbacks


fussy-southrollback should likely be considered a proof-of-concept or a bit of sample code. Your own migrations will likely require system specific modifications that would make using this script as-is an unreasonable choice.

If your firmware uses the South migration mechanism for Django, then you will likely need to be able to support running reverse migrations when the customer installs an older firmware. Because of how the migrations are stored, you will need to run the rollback migrations while the old firmware is installed.

You can support this by adding a call to fussy-southrollback to your .pre-install script. It will:

  • scan the relative path (-p argument) for migrations

  • do a textual compare on the sorted lists of migrations

  • find the set of identical items

  • IFF the new migrations are not a superset of the current migrations
    • will perform a migrate –noinput app migration
    • where migration is the last common migration among the pair of migrations


You must not rename a migration if you are using this code.

Module: fussy.southrollback

Utility functions for common tasks

fussy.southrollback.find_reverse_upgrades(final_target, relative_path, migration_pattern='????_*.py')[source]

Find reverse upgrades that must be run before final_target is installed

final_target – final target of the installation relative_path – path from final target to Django/South migrations

returns ID/number of the migration to run (if any)


Creates the OptionParser used in main()


Finds last common migration and reverts current Django db to that

Must be run with DJANGO_SETTINGS_MODULE set in the environment

Project Versions

Table Of Contents

Previous topic

Cron Lock

This Page