Add user follows to following feed
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
CREATE TABLE IF NOT EXISTS followed_users (
|
||||
follower_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
followed_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (follower_id, followed_id),
|
||||
CHECK (follower_id <> followed_id)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_followed_users_followed
|
||||
ON followed_users(followed_id, follower_id);
|
||||
Reference in New Issue
Block a user