mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-09-09 16:08:49 -06:00
![Dessalines](/assets/img/avatar_default.png)
* Showing # of unread comments for posts. Fixes #2134 * Fix lint. * Forgot to remove comment list update. * Fix clippy
12 lines
551 B
SQL
12 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)
|
|
);
|