zotonic/zotonic — comment on commit 3bce5248e0db3770fad01d0b93956a6d41643d25
File: modules/mod_mailinglist/models/m_mailinglist.erl line 440
By arjan:

Yes, this upgrade procedure is not ideal.
There is also z_db:ensure_table/2 which does magic to keep a database table up to date.

But an even better way is to let modules have a "schema version" property and let the module manager call an upgrade procedure, so that modules can write their own update scripts (adding/removing/renaming columns, indexes, denormalizing data, etc)

https://github.com/zotonic/zotonic/issues/43