When using SQL database, a very important aspect is table schema. Presently for comment system the table schema has to support association of graph with comments, comments association with nodes and edges. Also later we came up with the idea of pinned comments where the user can pin some comments and revisit them later. So the table schema was designed as below:
Comment is a weak entity because it cannot exist without a graph. So there is no association table for comment and graph and graph_id attribute is added in the Comment table.
CommentToNode table schema is as follows:
Multiple entries will be present in this table if a comment is associated with more than one node.
CommentToEdge table schema is as follows:
Multiple entries will be present in this table if a comment is associated with more than one edge.
PinComment table schema is as follows:
For pinning comments we store email of the user who pinned the comment and id of the comment.
- Comment table for storing comments.
- CommentToNode table for association between nodes and comments.
- CommentToEdge table for association between nodes and comments.
- PinComment table for association between users and their pinned comments.
Column Name
|
Data Type
|
Description
|
message
|
string
|
Comment message
|
owner_email
|
string
|
Email Id of user who
created the comment. |
graph_id
|
Integer
|
Id of the graph on which the comment is
being created |
parent_comment_id
|
Integer
|
If the comment is the parent then it’s value
is NULL otherwise comment is a reply to some other comment and parent-id exists for the comment. |
is_resolved
|
Integer
|
Value is 0 if the comment is resolved
otherwise 1. |
CommentToNode table schema is as follows:
Column Name
|
Data Type
|
Description
|
comment_id
|
Integer
|
Id of comment.
|
node_id
|
Integer
|
Id of node on which the comment is made.
|
CommentToEdge table schema is as follows:
Column Name
|
Data Type
|
Description
|
comment_id
|
Integer
|
Id of comment
|
edge_id
|
Integer
|
Id of edge on which the comment is made.
|
PinComment table schema is as follows:
Column Name
|
Data Type
|
Description
|
comment_id
|
Integer
|
Id of comment
|
owner_email
|
string
|
Email Id of the user who pinned the comment.
|
Comments
Post a Comment