M
M
Mozzarella2019-02-09 14:31:04
Database design
Mozzarella, 2019-02-09 14:31:04

Is it ok to store json in database?

There is a document, it has blocks of different types (header, table, list), the block has a hierarchical recursive relationship. The block has styles (font size, color)
Each block type can have additional fields (the table has headers and rows)
5c5eb9535b502153494647.png
Is it more expedient to store metadata and styles as json or create separate entities for this, or use entity inheritance?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sim3x, 2019-02-09
@sim3x

https://www.postgresql.org/docs/9.5/functions-json.html
json gives ambiguity that you, as a developer, will have to manually check in your code

V
Vitsliputsli, 2019-02-09
@Vitsliputsli

Will you need to get data from within json directly from the DB? If not, then it's a perfectly normal solution. Even if it is necessary and the database supports json, then it is possible, unless, of course, you do a selection on these entities.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question