I am developing some kind of web-based RPG. So for my
player domain I came up with this.
player object is going to have a lot of parameters like
name and so on. As it rather plain object I store it in the relational database like
PostgreSQL for example. I have an entity
RPlayer for that.
Also I wanted to introduce for the
player the ability to make contacts with other players - some basic feature of social network. For that reason I decided to use graph database like
Neo4J. I have an entity
GPlayer for that. It is simpler object with some unique fields like
As object became somehow distributed - I keep the data for it in different storages - I added mapping of
id in RDBMS to
id in graphDB. In the end it looks like this. (I don't know how to add fields in
draw.io to table so I have only three fields here and
name is missing).
I didn't connect
mapping table as one of the fields is external so I had no reason to connect
When I need to retrieve everything - I merge all the data from
GPlayer - player representation is graph - and
RPlayer - player representation is the table - into
CompletePlayer object that contains all the fields from both objects.
When I add new player
1. I create record in app.players table and get r_ID 2. I create node in graphDB and get g_ID 3. I create record in util.mapping for r_ID and g_ID
Also those 3 steps I am planning to do in scope of
Does such approach is ok? Should I somehow store domain in the single database and not spread it across different storages?