mirror of https://github.com/LemmyNet/lemmy
* Adding unique constraint for activity ap_id. Fixes #1878 * Removing is_activity_already_knownpull/1942/head
parent
76c4378011
commit
3d08e6c1fc
@ -0,0 +1,5 @@
|
||||
alter table activity alter column ap_id drop not null;
|
||||
|
||||
create unique index idx_activity_unique_apid on activity ((data ->> 'id'::text));
|
||||
|
||||
drop index idx_activity_ap_id;
|
@ -0,0 +1,22 @@
|
||||
|
||||
-- Delete the empty ap_ids
|
||||
delete from activity where ap_id is null;
|
||||
|
||||
-- Make it required
|
||||
alter table activity alter column ap_id set not null;
|
||||
|
||||
-- Delete dupes, keeping the first one
|
||||
delete
|
||||
from activity
|
||||
where id not in (
|
||||
select min(id)
|
||||
from activity
|
||||
group by ap_id
|
||||
);
|
||||
|
||||
-- The index
|
||||
create unique index idx_activity_ap_id on activity(ap_id);
|
||||
|
||||
-- Drop the old index
|
||||
drop index idx_activity_unique_apid;
|
||||
|
Loading…
Reference in New Issue