From Archivematica
< Improvements
Revision as of 17:30, 6 February 2017 by Hbecker (talk | contribs) (→‎Status: Completed)
Jump to navigation Jump to search

User Story

As a developer, I want to automatically generated changes to the database. As a systems administrator, I want to reliably upgrade and downgrade Archivematica.



Code written (Pull Request), included in Archivematica 1.5. The Archivematica Storage Service already has Django migrations (upgraded from the previous South migrations).


Please feel free to add your organization's name to this list, if you have an interest in this improvement.


Currently, Archivematica uses SQL files that are run by dpkg (for a package install) or a shell script (for an ansible or dev-helper install). These are complicated to write, have no error handling, and prone to failure.

We would like to move to Django migrations (new in Django 1.7) for the Archivematica 1.5 release.



  • existing process
  • faster in the short term to generate 1.5 packages
    • how much faster?


  • harder to move to ansible from packages
    • If the package install already has Django migrations, then ansible doesn't have to worry about faking migrations
  • will report success even if only some of the upgrade SQL scripts were run

Django migrations

Code would be added to the debian postinst script to fake dpkg-run migrations. We would only back-create migrations for 1.4.1 to 1.5.0. Any older installs of Archivematica would have to upgrade to 1.4.1, then upgrade to 1.5.0.


  • Easier to move to ansible from a package install
  • No hard-to-read mysql seed file that has to be re-generated for every release
  • Works better with tests, since testing and production code are the same (database not generated by dpkg SQL)


  • Prone to bugs in the short term (relating to differences in how the mysql seed files created tables vs how Django models create tables)
  • All of these bugs have to be fixed before 1.5 release, which takes time away from other projects


We will try adding Django migrations to 1.5. If too many bugs (how many?) come up in the testing phase, we will revert to dpkg.