1 -- Add unique ap_id for private_message, comment, and post
2 -- Need to delete the possible dupes for ones that don't start with the fake one
3 DELETE FROM private_message a USING (
17 DELETE FROM post a USING (
31 DELETE FROM comment a USING (
45 -- Replacing the current default on the columns, to the unique one
49 ap_id = generate_unique_changeme ()
51 ap_id = 'http://fake.com';
56 ap_id = generate_unique_changeme ()
58 ap_id = 'http://fake.com';
63 ap_id = generate_unique_changeme ()
65 ap_id = 'http://fake.com';
67 -- Add the unique indexes
68 ALTER TABLE private_message
69 ALTER COLUMN ap_id SET NOT NULL;
71 ALTER TABLE private_message
72 ALTER COLUMN ap_id SET DEFAULT generate_unique_changeme ();
75 ALTER COLUMN ap_id SET NOT NULL;
78 ALTER COLUMN ap_id SET DEFAULT generate_unique_changeme ();
81 ALTER COLUMN ap_id SET NOT NULL;
84 ALTER COLUMN ap_id SET DEFAULT generate_unique_changeme ();
86 -- Add the uniques, for user_ and community too
87 ALTER TABLE private_message
88 ADD CONSTRAINT idx_private_message_ap_id UNIQUE (ap_id);
91 ADD CONSTRAINT idx_post_ap_id UNIQUE (ap_id);
94 ADD CONSTRAINT idx_comment_ap_id UNIQUE (ap_id);
97 ADD CONSTRAINT idx_user_actor_id UNIQUE (actor_id);
100 ADD CONSTRAINT idx_community_actor_id UNIQUE (actor_id);