[ckan-changes] [ckan/ckan] 4b438a: Allow extensions to contain migrations

GitHub noreply at github.com
Thu Dec 10 18:05:51 UTC 2015


  Branch: refs/heads/2784-migrations-for-extensions
  Home:   https://github.com/ckan/ckan
  Commit: 4b438a5124e5f1c15cfad7d83ebda888e05e34c2
      https://github.com/ckan/ckan/commit/4b438a5124e5f1c15cfad7d83ebda888e05e34c2
  Author: Ross Jones <ross at servercode.co.uk>
  Date:   2015-12-10 (Thu, 10 Dec 2015)

  Changed paths:
    M ckan/migration/migrate.cfg
    M ckan/model/__init__.py
    M ckan/pastertemplates/template/MANIFEST.in_tmpl
    A ckan/pastertemplates/template/ckanext/+project_shortname+/migrations/__init__.py
    A ckan/pastertemplates/template/ckanext/+project_shortname+/migrations/migrate.cfg
    A ckan/pastertemplates/template/ckanext/+project_shortname+/migrations/versions/001_initial_creation.py
    A ckan/pastertemplates/template/ckanext/+project_shortname+/migrations/versions/__init__.py
    M ckan/pastertemplates/template/ckanext/+project_shortname+/plugin.py_tmpl
    M ckan/plugins/interfaces.py

  Log Message:
  -----------
  Allow extensions to contain migrations

As currently managing database tables in extensions is rather painful we
end up with developers either checking and creating the tables at
startup time, or creating paster command specific to their extension
which creates tables. Running actual migrations is often problematic.

These changes provide a new interface called IMigration that allows an
extension to specify where it stored its migrations.  These migrations
are then run whenever the ```db upgrade``` command is executed.

The paster templates for creating a new extension are also updated to
automatically created the required files for running migrations.




More information about the ckan-changes mailing list