Go to page content

Upgrading to Zotonic 0.8

If you're upgrading to 0.8 from an older release, keep the following in mind.

photo.JPG
Module versioning

From 0.8, modules have a schema version concept, which is used to install and update module-specific data (like managed tables, custom categories, default data). Previously this was either done in the module's init() or datamodel() function. The second option does no longer work in 0.8.

Instead, modules export a -module_schema() attribute which contains an integer number, denoting the current module's version. On module initialization, Module:manage_schema/2 is called which handles installation and upgrade of data. Minimal example:

-module(mod_twitter).
-mod_title("Twitter module").
-mod_schema(3). %% we are currently at revision 3

-export([manage_schema/2]).
.... more code here...

manage_schema(install, Context) ->
% .. code to install your stuff here, for instance:
#datamodel{categories=
               [
                {tweet,
                 text,
                 [{title, <<"Tweet">>}]}
               ]};

manage_schema({upgrade, 2}, Context) ->
%% code to upgrade from 1 to 2
ok;

manage_schema({upgrade, 3}, Context) ->
%% code to upgrade from 2 to 3
ok.

Note that the install function should always be kept up-to-date according to the latest schema version. When you install a module for the first time, no upgrade functions are called, but only the install clause.

mod_mailinglist

The mailinglist has changed a bit. You need to enable the mod_logging module. It should be enabled automatically, but please double-check.

Execute the following query to get email sending working:

alter table mailinglist_recipient add column is_bounced boolean not null default false;

That should be all!

This page is part of the Zotonic documentation, which is licensed under the Apache License 2.0.