discourse/discourse — pull request #2077 by ArmedGuy (2014-03-08 01:57:26+00:00)
Title: A draft for metadata storage to be used in plugins.

As title says, this is a draft, and I would like some input on how I have structured it, and wheter it might be something that could be put in the core.

The initial idea, written [here](https://meta.discourse.org/t/custom-database-models-example-plugin/13014/9), kinda goes like this:
* Implement tables similar to wp_usermeta in WordPress, but for users, posts and topics(for now)
* Expose these on server-side in the correct models, and leave it open for plugin devs to use
* Optionally allow read-only exposure to the frontend for metadata with client set to true.

The small changes would give plugin devs the possibility to do many basic things without filling the existing tables for users/posts/topics, and without the need to deploy their own tables.

____________
#### Some notes
* In the topic Model, I found that a key->value system named meta_data was already in place(using Postgres hstore). What is this used for and could it possibly be moved to this new system?

* I did not write anything in the topic serializer, as I was not sure where to expose the metadata there. Where would it be most useful?