我有几个表,例如:
news:
id | title | description
1 | This is first title of news | This is description
2 | This is second title of news | This is second description
blog:
id | title | description
1 | This is first title of blog | This is description
2 | This is second title of blog | This is second description
还有10多张桌子。
我需要添加一个字段“some_state”,它可以有两个值:0 或 1。
所以我可以通过两种方式:
1)将此字段添加到每个表中;
2)创建新表,例如:
tables_some_state:
id | table_name | table_id | some_state
1 | news | 1 | 0
2 | news | 2 |1
3 | blog | 1 | 1
4 | blog | 2 | 1
...
并使用将此表左连接到我的查询中的每个表。
那么,就我而言,最佳实践是什么?