gator/sql/postgres/schema/005_add_posts_table.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

15 lines
411 B
SQL

-- +goose Up
CREATE TABLE posts (
id UUID PRIMARY KEY,
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL,
title TEXT NOT NULL DEFAULT 'Undefined',
url varchar(255) NOT NULL UNIQUE,
description TEXT NOT NULL DEFAULT 'Undefined',
published_at TIMESTAMP NOT NULL,
feed_id UUID NOT NULL,
FOREIGN KEY (feed_id) REFERENCES feeds(id) ON DELETE CASCADE
);
-- +goose Down
DROP TABLE posts;