Skip to main content

Blog/News Data Models and APIs

Blog Schemas

Diagram example

Posts Table

ColumnTypeDescription
post_idintegerPrimary key for the post
titlestringTitle of the post
contenttextBody content of the post
author_idintegerForeign key to the users table for the author
created_atdatetimeTimestamp of when the post was created
updated_atdatetimeTimestamp of when the post was last updated

Comments Table

ColumnTypeDescription
comment_idintegerPrimary key for the comment
post_idintegerForeign key to the posts table for the commented post
contenttextBody content of the comment
author_idintegerForeign key to the users table for the comment author
created_atdatetimeTimestamp of when the comment was created
updated_atdatetimeTimestamp of when the comment was last updated

Users Table

ColumnTypeDescription
user_idintegerPrimary key for the user
usernamestringUsername for the user
emailstringEmail address of the user
passwordstringHashed password of the user
created_atdatetimeTimestamp of when the user account was created
updated_atdatetimeTimestamp of when the user account was last updated

Tags Table

ColumnTypeDescription
tag_idintegerPrimary key for the tag
namestringName of the tag
created_atdatetimeTimestamp of when the tag was created
updated_atdatetimeTimestamp of when the tag was last updated

Post Tags Table

ColumnTypeDescription
post_tag_idintegerPrimary key for the post-tag relationship
post_idintegerForeign key to the posts table for the tagged post
tag_idintegerForeign key to the tags table for the tag
created_atdatetimeTimestamp of when the relationship was created
updated_atdatetimeTimestamp of when the relationship was last updated

Images Table

ColumnTypeDescription
image_idintegerPrimary key for the image
urlstringURL of the image file
captionstringCaption for the image
created_atdatetimeTimestamp of when the image was added
updated_atdatetimeTimestamp of when the image was last updated

Blog/News APIs

APIs and Microservices