Clojure – PostgreSQL Test DB

ref : https://github.com/briancarper/oyako/wiki/Example

CREATE TABLE category (
id integer PRIMARY KEY,
name text
);
CREATE TABLE tag (
id integer PRIMARY KEY,
name text
);
CREATE TABLE post (
id integer PRIMARY KEY,
title text,
content text,
category_id integer REFERENCES category (id)
);
CREATE TABLE comment (
id integer PRIMARY KEY,
post_id integer REFERENCES post (id),
content text
);
CREATE TABLE post_tag (
id integer PRIMARY KEY,
post_id integer REFERENCES post (id),
tag_id integer REFERENCES tag (id)
);
INSERT INTO category VALUES (1, 'Cows');
INSERT INTO category VALUES (2, 'Programming');
INSERT INTO tag VALUES (1, 'Current event');
INSERT INTO tag VALUES (2, 'Editorial');
INSERT INTO tag VALUES (3, 'Elucidation');
INSERT INTO post VALUES (1, 'Cows rule', 'Everyone likes cows, right?', 1);
INSERT INTO post VALUES (2, 'Clojure rocks', 'Everyone likes Clojure, right?', 2);
INSERT INTO comment VALUES (1, 2, 'Brian', 'Me too!');
INSERT INTO post_tag VALUES (1, 1, 1);
INSERT INTO post_tag VALUES (2, 1, 3);
INSERT INTO post_tag VALUES (3, 2, 2);
INSERT INTO post_tag VALUES (4, 2, 3);

댓글 남기기

이메일은 공개되지 않습니다. 필수 입력창은 * 로 표시되어 있습니다