In my previous work station, I saw them have a table design across all website they have worked on displaying editor content like this:
column|page_id| title |content_1|... |content_n| lang |update_date|...
-----------------------------------------------------------------------
row | 1 |varchar| text |text| text |tinyint| datetime |
......
where
content_n
column are determined by the max editor it overall has on that website.For an example: If the website generally has 1 editable content per page but in addition, there is one page that has 4 editable content, they will have 4
content_n
column.
The problem(imo):
For pages that have only 1 editable content area, only content_1
will be filled, and other column content_n
will be empty
. In addition, with multiple languages involve, those empty field add up.
My question:
- Is this a good design of choice?
- Wouldn't those empty column create unnecessary overhead?
- What would be an improved table design when have a table such as this?
My thought :
I will probably merge all the content and title into one single column(mediumtext/longtext) and use json_encode/array
to differentiate the content.
they usemysql(MYISAM)
for all database engineer, and I prefer Innodb
..if that is matter