--- langs: en tags: cofacts title: Cofacts DB Mapping GA: UA-98468513-3 description: Updated at 2020/5/7 --- - ๐Ÿ”‘: field used in `_id` key; combinations must be unique within index. - Solid line: foreign key relation - Dotted line: cached field, or having interaction ```graphviz graph mappings{ rankdir=LR; node[shape=record]; replyrequests [label=" ๐ซ๐ž๐ฉ๐ฅ๐ฒ๐ซ๐ž๐ช๐ฎ๐ž๐ฌ๐ญ๐ฌ | <id>articleId๐Ÿ”‘\l | <user> userId๐Ÿ”‘\l appId๐Ÿ”‘\l | reason\l | <timestamps> createdAt\l updatedAt\l | { feedbacks\n (nested) | { score\l | userId\l appId\l | createdAt\l updatedAt\l } } | positiveFeedbackCount\l negativeFeedbackCount\l "] articlereplyfeedbacks [fixedsize="true" width="3" height="2" label=" ๐š๐ซ๐ญ๐ข๐œ๐ฅ๐ž๐ซ๐ž๐ฉ๐ฅ๐ฒ๐Ÿ๐ž๐ž๐๐›๐š๐œ๐ค๐ฌ | <id>articleId๐Ÿ”‘\l | <replyid>replyId๐Ÿ”‘\l | userId๐Ÿ”‘\l appId๐Ÿ”‘\l | <score> score\l | comment\l | createdAt\l updatedAt\l "] articlecategoryfeedbacks [fixedsize="true" width="3" height="2" label=" ๐š๐ซ๐ญ๐ข๐œ๐ฅ๐ž๐œ๐š๐ญ๐ž๐ ๐จ๐ซ๐ฒ๐Ÿ๐ž๐ž๐๐›๐š๐œ๐ค๐ฌ | <id>articleId๐Ÿ”‘\l | <categoryid>categoryId๐Ÿ”‘\l | userId๐Ÿ”‘\l appId๐Ÿ”‘\l | <score> score\l | comment\l | createdAt\l updatedAt\l "] replies [label=" <id>๐ซ๐ž๐ฉ๐ฅ๐ข๐ž๐ฌ | userId\l appId\l | <type> type\l | text\l | { hyperlinks \n(nested) | { <url> url\l | <title> title\l | <summary> summary\l } } | reference\l | createdAt\l "] articles [label=" <id> ๐š๐ซ๐ญ๐ข๐œ๐ฅ๐ž๐ฌ | <requests> replyRequestCount\l lastRequestedAt\l | createdAt\l updatedAt\l | text๐Ÿ”‘\l | userId\l appId\l | { references\n (nested) | { type\l permalink\l createdAt\l | userId\l appId\l } } | { articleReplies \n(nested) | { <reply> replyId\l | <feedbackcounts> positiveFeedbackCount\l negativeFeedbackCount\l | <replytype> replyType\l | userId\l appId\l | status\l | createdAt\l updatedAt\l } } | normalArticleReplyCount\l | { articleCategories \n(nested) | { <category> categoryId\l | <categoryfeedbackcounts> positiveFeedbackCount\l negativeFeedbackCount\l | aiModel\l aiConfidence\l | userId\l appId\l | status\l | createdAt\l updatedAt\l } } | normalArticleCategoryCount\l | { hyperlinks \n(nested) | { <url> url\l normalizedUrl\l | <title> title\l | <summary> summary\l } } "] categories[label=" <id>๐œ๐š๐ญ๐ž๐ ๐จ๐ซ๐ข๐ž๐ฌ | title\l | description\l | createdAt\l updatedAt\l "] urls[label=" <id>๐ฎ๐ซ๐ฅ๐ฌ | <url>url\l canonical\l | <title>title\l | <summary>summary\l | html\l topImageUrl\l | fetchedAt\l status\l error\l isReferenced\l "] users[label=" <id>๐ฎ๐ฌ๐ž๐ซ๐ฌ | email\l name\l avatarUrl\l | facebookId\l githubId\l twitterId\l | createdAt\l updatedAt\l "] articles:id -- replyrequests:id; articles:requests -- replyrequests:timestamps [style="dotted"]; articles:category -- categories:id; articles:url -- urls:url; articles:id -- articlereplyfeedbacks:id; articles:id -- articlecategoryfeedbacks:id; articles:reply -- articlereplyfeedbacks:replyid; articles:category -- articlecategoryfeedbacks:categoryid; articles:reply -- replies:id; articles:feedbackcounts -- articlereplyfeedbacks:score [style="dotted"]; articles:categoryfeedbackcounts -- articlecategoryfeedbacks:score [style="dotted"]; articles:replytype -- replies:type [style="dotted"]; articles:title -- urls:title [style="dotted"]; articles:summary -- urls:summary [style="dotted"]; replies:url -- urls:url; replies:title -- urls:title [style="dotted"]; replies:summary -- urls:summary [style="dotted"]; } ```