[erlang-questions] Application setup

Kirill Zaborski qrilka@REDACTED
Sat Jun 16 17:00:04 CEST 2007

Seems reasonable but what if I stop application and then restart it for some
reason? I want to retain all the data that will be collected in the
application tables (some of them may be persistent).


On 6/16/07, Sean Hinde <sean.hinde@REDACTED> wrote:
> On 16 Jun 2007, at 15:08, Kirill Zaborski wrote:
> > What is the recommended way to do application setup in OTP? I mean
> > what if my application requires some initialization steps before
> > running? E.g. it requires some mnesia tables created.
> > As I understand for release upgrade I can do this using *.appup
> > files in OTP Design Principles I see only example of process state
> > modification is it OK to transform mnesia tables in code_change/3?
> > And what do I when I install my application first time?
> I would suggest to define some record that all parts of your system
> can use to define table definitions, then at system startup doing
> something like:
> 1. Find the list of all table definition records.
> 2. Attempt to create all tables.
> 3. Any that are already created (return {aborted,{already_exists,_}})
> compare the fields and if different do a table transform.
> This way you not only get the tables created at startup, but you also
> get auto upgrade.
> You could do this during startup of one of your first applications.
> Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070616/c24ff0c4/attachment.htm>

More information about the erlang-questions mailing list