file sets up your modules database structure.
Any module can create as many normal database tables as it likes, but in addition to that it also gets the option to have a 'datastore'
Anyone familiar with MySql database structure will know the normal pattern for a database table is similar to an excel spread sheet with column names at the top, then data in rows beneath those column headings.
A normal MySql database table can have as many columns as it needs, but all those columns must be created in order to store data in them.
So an example of that would be the user table from JR4
user_id | user_name | user_email | user_........
There were about a hundred columns in the table.
Jamroom has a new type of database storage system. It is a key-value system (Wikipedia
What that means is there is essentially 2 columns. The key
and the value
name | jim
email | email@example.com
The usefulness of this is really felt when you don't know the structure of the data that is coming back to you. You don't need to create a 'name' colum to store the name. You don't need to create an 'email' column to store the email.
So you don't need to touch the database to add new stuff to it.
If other modules want to add bits and pieces onto your modules stuff, they can.
A good example of this is the tags module adding tags onto a song. The song info is stored in the jrAudio's datastore. But because it IS a datastore, the jrTags module can add in the tags = 'whatever,tags,there,are' to an item.
When someone requests the item, they get the tags too.
To setup your modules datastore, use this code in your schema.php file.