mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-27 06:41:18 +00:00
Nutomic
e9e76549a8
* Split activity table into sent and received parts (fixes #3103) The received activities are only stored in order to avoid processing the same incoming activity multiple times. For this purpose it is completely unnecessary to store the data. So we can split the table into sent_activity and received_activity parts, where only sent_activity table needs to store activity data. This should reduce storage use significantly. Also reduces activity storage duration to three months, we can reduce this further if necessary. Additionally the id columns of activity tables are removed because they are completely unused and risk overflowing (fixes #3560). * address review * move insert_received_activity() methods to verify handlers * remove unnecessary conflict line * clippy * use on conflict, add tests
21 lines
No EOL
599 B
SQL
21 lines
No EOL
599 B
SQL
create table activity (
|
|
id serial primary key,
|
|
data jsonb not null,
|
|
local boolean not null default true,
|
|
published timestamp not null default now(),
|
|
updated timestamp,
|
|
ap_id text not null,
|
|
sensitive boolean not null default true
|
|
);
|
|
|
|
insert into activity(ap_id, data, sensitive, published)
|
|
select ap_id, data, sensitive, published
|
|
from sent_activity
|
|
order by id desc
|
|
limit 100000;
|
|
|
|
-- We cant copy received_activity entries back into activities table because we dont have data
|
|
-- which is mandatory.
|
|
|
|
drop table sent_activity;
|
|
drop table received_activity; |