Replies


Description

Replies table, ParentReplyId of a layer one reply is null.

Columns

Column Type Size Nulls Auto Default Children Parents Comments
id uuid 2147483647 null
Replies.ParentReplyId Replies_ParentReplyId_fkey C
ReplyNotifications.ReplyId ReplyNotifications_ReplyId_fkey R
Contents.id Replies_id_fkey C

Primary Key, also a Foreign key references Contents table, this is a sub table of Contents table.

UserId uuid 2147483647 null
Users.id Replies_UserId_fkey N

Foreign Key references Users table, author of the reply.

RootContentId uuid 2147483647 null
Contents.id Replies_RootContentId_fkey C

Foreign Key references Contents table, the top level content this reply belongs to.

ParentReplyId uuid 2147483647 null
Replies.id Replies_ParentReplyId_fkey C

Foreign Key references Replies table, only available in layer two replies.

content jsonb 2147483647 null

Reply content, a json object.

createdAt timestamptz 35,6 now()
updatedAt timestamptz 35,6 now()
status "gcud"."enum_Contents_status" 2147483647 'UNCATEGORIZED'::gcud."enum_Contents_status"

Content status enum, default is UNCATEGORIZED, used in CMS moderation stuff

CMSCreatorId uuid 2147483647 null
Users.id Replies_CMSCreatorId_fkey N

Foreign Key to Users table, who created this reply via CMS system.

Indexes

Constraint Name Type Sort Column(s)
Replies_pkey Primary key Asc id
gcud_Replies_createdAt_idx Performance Asc createdAt
gcud_Replies_ParentReplyId_idx Performance Asc ParentReplyId
gcud_Replies_RootContentId_idx Performance Asc RootContentId
gcud_Replies_status_idx Performance Asc status
gcud_Replies_updatedAt_idx Performance Asc updatedAt
Replies_fullText_idx Performance
Replies_status_createdAt_idx Performance Asc/Desc status + createdAt
Replies_UserId_idx Performance Asc UserId

Check Constraints

Constraint Name Constraint
check_id (((id <> "RootContentId") AND (id <> "ParentReplyId") AND ("RootContentId" <> "ParentReplyId")))
check_reply_userId (((status = 'TRASH'::gcud."enum_Contents_status") OR ("UserId" IS NOT NULL)))

Relationships