Hi,
Is there a documentation of the ejabberd's Mnesia database schema anywhere?
I understand that I can grep through the code looking for "-record" and correlate that to entries in the Erlang's table viewer tool, but I hope there's a better way...
Serge
erlang's tv is handy for debugging
I'm not aware of any public documentation. An alternative (or complement) to source code investigation is Erlang's Table Viewer. It is a graphical (Tk) interface to ETS and Mnesia tables.
The easiest way to get TV working with ejabberd is:
And a window should appear called 'ETS tables on xx'.
Re: database schema
I'm not aware of any public documentation. An alternative (or complement) to source code investigation is Erlang's Table Viewer. It is a graphical (Tk) interface to ETS and Mnesia tables.
Yes, I mentioned the Table Viewer in my original posting (which is what I used to examine the tables). However, the table fields are composite, and tv tool can't show the nested elements of a record since records are tuples of arbitrary terms. For example:
-record(passwd, {us, password}).
Here 'us' is actually a composite field containing {Username, Server}. The way to figure it out is really by looking at the record definition in the *.hrl file hoping that it is defined more verbosely...
At least when I write mnesia applications I tend to put all application-specific record definitions in a single file with description of a schema, which makes support much easier.
Oh, well, I'll try to extract the schema data the hard way. Is there a place on the site I can submit that document so that it can be evolved by the community?
Serge
On this forum
Yes, I mentioned the Table Viewer in my original posting
Sorry, I didn't read that part. Anyway, I'll re-use the minitutorial sometime on the future :)
Oh, well, I'll try to extract the schema data the hard way. Is there a place on the site I can submit that document so that it can be evolved by the community?
You can submit your text to the forums, and people may add comments. Then, you are free to modify your forum post and include those suggestions. Once you consider the text to be almost complete, it could be included onejabberd Developers Guide .
BTW, the DB schema may vary on future ejabberd versions. So if ejabberd already exports a function that solves the requirement, it's preferable instead of writting Mnesia specific code.