Skip to content

Latest commit

 

History

History
54 lines (41 loc) · 1.48 KB

public.post_comments.md

File metadata and controls

54 lines (41 loc) · 1.48 KB

public.post_comments

Description

post and comments View table

Table Definition
CREATE VIEW post_comments AS (
 SELECT c.id,
    p.title,
    u.username AS post_user,
    c.comment,
    u2.username AS comment_user,
    c.created,
    c.updated
   FROM (((posts p
     LEFT JOIN comments c ON ((p.id = c.post_id)))
     LEFT JOIN users u ON ((u.id = p.user_id)))
     LEFT JOIN users u2 ON ((u2.id = c.user_id)))
)

Columns

Name Type Default Nullable Children Parents Comment
id bigint true comments.id
title varchar(255) true posts.title
post_user varchar(50) true posts.users.username
comment text true
comment_user varchar(50) true comments.users.username
created timestamp without time zone true comments.created
updated timestamp without time zone true comments.updated

Referenced Tables

Name Columns Comment Type
public.posts 8 Posts table BASE TABLE
public.comments 7 Comments
Multi-line
table
comment
BASE TABLE
public.users 6 Users table BASE TABLE

Relations

er


Generated by tbls