K
K
keksum6662021-10-28 14:02:18
Database design
keksum666, 2021-10-28 14:02:18

How to implement connections?

Hello!
I find it difficult to implement the following relationship:
1) Table blocks

  • id
  • title
  • structure

2) Table Pages:
  • id
  • title

3) entities_blocks table
  • id
  • entity_type
  • entity_id
  • block_id

That is, a many-to-many polymorphic relationship is implemented between blocks and pages.
The goal is:
How to implement an attribute table for a pivot table?
That is, I want the blocks to have attributes, that is, something like this table
  1. id
  2. block_entity_id
  3. key
  4. value


(It is not an option to suggest making fields in the database for each key option, because they will be dynamic)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question