openresty/demo/Blog/misc/mysql/init-db.sql

26 lines
592 B
C
Raw Normal View History

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,
2010-04-12 10:57:03 +00:00
title text not null,
2010-01-20 09:59:01 +00:00
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,
2010-01-20 10:34:27 +00:00
email varchar(64),
2010-01-20 10:05:41 +00:00
url varchar(1024),
2010-01-20 10:22:24 +00:00
body text not null,
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)
);