]> Untitled Git - lemmy.git/blob - migrations/2022-11-21-204256_user-following/up.sql
Fixing broken SQL migration formatting. (#3800)
[lemmy.git] / migrations / 2022-11-21-204256_user-following / up.sql
1 -- create user follower table with two references to persons
2 CREATE TABLE person_follower (
3     id serial PRIMARY KEY,
4     person_id int REFERENCES person ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
5     follower_id int REFERENCES person ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
6     published timestamp NOT NULL DEFAULT now(),
7     pending boolean NOT NULL,
8     UNIQUE (follower_id, person_id)
9 );
10
11 UPDATE
12     community_follower
13 SET
14     pending = FALSE
15 WHERE
16     pending IS NULL;
17
18 ALTER TABLE community_follower
19     ALTER COLUMN pending SET NOT NULL;
20