Add relation between posts and authors

This commit is contained in:
Bat
2018-04-23 15:37:49 +01:00
parent e506cd21b7
commit a816bb00b7
5 changed files with 54 additions and 0 deletions
@@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE post_authors;
@@ -0,0 +1,6 @@
-- Your SQL goes here
CREATE TABLE post_authors (
id SERIAL PRIMARY KEY,
post_id INTEGER REFERENCES posts(id) ON DELETE CASCADE NOT NULL,
author_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL
)