mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-19 02:44:02 +00:00
0aeb78b8f3
* Showing # of unread comments for posts. Fixes #2134 * Fix lint. * Forgot to remove comment list update. * Fix clippy
11 lines
551 B
SQL
11 lines
551 B
SQL
-- This table stores the # of read comments for a person, on a post
|
|
-- It can then be joined to post_aggregates to get an unread count:
|
|
-- unread = post_aggregates.comments - person_post_aggregates.read_comments
|
|
create table person_post_aggregates(
|
|
id serial primary key,
|
|
person_id int references person on update cascade on delete cascade not null,
|
|
post_id int references post on update cascade on delete cascade not null,
|
|
read_comments bigint not null default 0,
|
|
published timestamp not null default now(),
|
|
unique(person_id, post_id)
|
|
);
|