나는 사용자가 기사를 평가하는 새 프로젝트를 진행하고 있습니다. 해당 주제와 관련된 블로그 게시물의 양에 따라 0-3의 등급이 부여되는 주제/태그 목록이 있습니다.평가가있는 주제에 대한 스키마 디자인
0 주제가 기사와 관련이없고 3 의미는 주제가 기사와 관련이 있음을 의미합니다. 유일한 문제는 주제가 기사와 관련이 있는지 여부와 관계없이 모든 기사가 모든 주제와 어떤 관계가 있어야한다는 것입니다.
는 여기에 내가 (20 개 항목이 실제로있다)
/**
* Option 1
*
* for every article created, a tag will be
* created for each topic all containing a reference
* to the article
*/
trait Topic
object Topics {
topic1 extends Topic
topic2 extends Topic
topic3 extends Topic
}
case class Article(id:Int, title:String, content:String)
case class Tag(id:Int, articleId:Int, topic:Topic)
/**
* Option 2
*
* remember each topic has a rating 0-3
* and there are actually about 20 total topics
*/
case class Article(id:Int,
title:String,
content:String,
topic1:Int,
topic2:Int,
topic3:Int)
/**
* Option 3
*
* topics with either a rating of 2 or 3
* will be created with a reference to the article
* and topics with a 0 with be created but inside a
* "has_nothing_to_do_with_the_article" table
* all the other topics will be not be created and will
* just default to 1.
*/
, 나는 어떤 조언에 감사보다 더 많은 것하십시오 해낸거야. 이와 비슷한 것을위한 베스트 프랙티스 (스키마 & db 모델링)는 무엇입니까?