Oh, I missed your point about {abprted,{already_exists,_}}<br>Thanks!<br><br>Regards,<br>Kirill.<br><br><div><span class="gmail_quote">On 6/16/07, <b class="gmail_sendername">Sean Hinde</b> <<a href="mailto:sean.hinde@gmail.com">
sean.hinde@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">create_table will leave the table unchanged (including contents) if
<br>it already exists. In that way it behaves as a handy shorthand for<br>checking whether the table exists and creating it if it does not.<br><br>Sean<br><br>On 16 Jun 2007, at 16:00, Kirill Zaborski wrote:<br><br>> Seems reasonable but what if I stop application and then restart it
<br>> for some reason? I want to retain all the data that will be<br>> collected in the application tables (some of them may be persistent).<br>><br>> Regards,<br>> Kirill<br>><br>> On 6/16/07, Sean Hinde <
<a href="mailto:sean.hinde@gmail.com">sean.hinde@gmail.com</a>> wrote:<br>> On 16 Jun 2007, at 15:08, Kirill Zaborski wrote:<br>><br>> > What is the recommended way to do application setup in OTP? I mean<br>
> > what if my application requires some initialization steps before<br>> > running? E.g. it requires some mnesia tables created.<br>> > As I understand for release upgrade I can do this using *.appup<br>
> > files in OTP Design Principles I see only example of process state<br>> > modification is it OK to transform mnesia tables in code_change/3?<br>> > And what do I when I install my application first time?
<br>><br>> I would suggest to define some record that all parts of your system<br>> can use to define table definitions, then at system startup doing<br>> something like:<br>><br>> 1. Find the list of all table definition records.
<br>> 2. Attempt to create all tables.<br>> 3. Any that are already created (return {aborted,{already_exists,_}})<br>> compare the fields and if different do a table transform.<br>><br>> This way you not only get the tables created at startup, but you also
<br>> get auto upgrade.<br>><br>> You could do this during startup of one of your first applications.<br>><br>> Sean<br>><br>><br><br></blockquote></div><br>