2010-01-20 09:59:01 +00:00
|
|
|
-- Blog posts
|
2010-01-20 10:05:41 +00:00
|
|
|
drop table if exists posts;
|
2010-01-20 09:59:01 +00:00
|
|
|
create table posts (
|
|
|
|
id serial,
|
|
|
|
title varchar(128) not null,
|
|
|
|
content text not null,
|
|
|
|
author varchar(64) not null,
|
|
|
|
created timestamp(0) default now() not null,
|
|
|
|
comments integer default 0 not null,
|
|
|
|
primary key (id)
|
|
|
|
);
|
|
|
|
|
|
|
|
-- Blog comments
|
2010-01-20 10:05:41 +00:00
|
|
|
drop table if exists comments;
|
2010-01-20 09:59:01 +00:00
|
|
|
create table comments (
|
|
|
|
id serial,
|
|
|
|
sender varchar(64) not null,
|
|
|
|
email varchar(64) not null,
|
2010-01-20 10:05:41 +00:00
|
|
|
url varchar(1024),
|
2010-01-20 09:59:01 +00:00
|
|
|
body text,
|
2010-01-20 10:05:41 +00:00
|
|
|
created timestamp(0) default now() not null,
|
|
|
|
post bigint not null,
|
2010-01-20 09:59:01 +00:00
|
|
|
foreign key (post) references posts(id)
|
|
|
|
);
|
|
|
|
|