Files
gator/sql/schema/003_follows.sql
T
Stevan Freeborn f51b1b941a feat: added new commands
- added follow command
- added unfollow command
- following command
- introduced logged in user middleware
2026-08-02 07:49:57 -05:00

15 lines
395 B
SQL

-- +goose Up
CREATE TABLE follows (
id UUID PRIMARY KEY,
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL,
user_id UUID NOT NULL,
feed_id UUID NOT NULL,
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY(feed_id) REFERENCES feeds(id) ON DELETE CASCADE,
CONSTRAINT unique_user_feed UNIQUE(user_id, feed_id)
);
-- +goose Down
DROP TABLE follows;