gator/sql/postgres/schema/003_feed_follows.sql
Dan Anglin cfa6a4abad
refactor: move postgres SQL files
Move the postgres SQL schema and query files to sql/postgres.
2024-10-01 06:51:10 +01:00

14 lines
379 B
SQL

-- +goose Up
CREATE TABLE feed_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,
UNIQUE(user_id, feed_id)
);
-- +goose Down
DROP TABLE feed_follows;