goose/testdata/migrations/00002_posts_table.sql

15 lines
332 B
SQL

-- +goose Up
-- +goose StatementBegin
CREATE TABLE posts (
id INTEGER PRIMARY KEY,
title TEXT NOT NULL,
content TEXT NOT NULL,
author_id INTEGER NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (author_id) REFERENCES users(id)
);
-- +goose StatementEnd
-- +goose Down
DROP TABLE posts;