20140327 (Thursday, 27 March 2014)

The Migrator class - inheritance for Migrations

The migration which I used yesterday in Chatelet to migrate the production server was only for the “Chatelet” variant of Lino Welfare. That is, for a Lino Welfare which uses the “alternate” implementation of the courses app.

This was enough to run the upgrade in Chatelet, which was my most urgent goal. But I must not leave it as this since in an “Eupen” variant they don’t want to convert their courses tables.

Now I replaced migration_module by migration_class. This allows us to define “Migrators” as classes who inherit from each other. Technically I could have the Site class themself, but it looks more clean when migration code is in a single module (or package), but not together with settings.

Usage example: module lino_welfare.settings.chatelet.migrate.

Note: yes, Django 1.7 will have its own migrations, basically inspired by South. That might look as a clear reason to abandon north and start using Django migrations. Note that if you don’t like north, you can simply use South or Django 1.7 migrations. But:

  • There is no immediate need for me to learn. I’ll wait at least until Django 1.7 is released.
  • There are certain Lino magics for which I don’t yet see how I’d do them using South. Examples:
    • migrating from one language distribution to another
    • injected fields and interdependent apps

Welfare Uploads