| 1 | create table follows ( |
| 2 | follower_id bigint not null references users (id), |
| 3 | followee_id bigint not null references users (id), |
| 4 | created_at timestamptz not null default now(), |
| 5 | primary key (follower_id, followee_id), |
| 6 | constraint no_self_follow check (follower_id <> followee_id) |
| 7 | ); |
| 8 | |
| 9 | create index follows_followee_id_follower_id_idx on follows (followee_id, follower_id); |