/*
create table BlogEntry {
id char(36) not null,
date_and_time char(14) not null,
title varchar(250) not null,
content text not null,
comment_allowed tinyint(1),
hide tinyint(1),
unique (id),
primary key (id)
}
*/
CREATE TABLE `BlogEntry` (
 `id` CHAR( 36 ) NOT NULL ,
 `date_and_time` CHAR( 14 ) NOT NULL ,
 `title` VARCHAR( 250 ) NOT NULL ,
 `content` TEXT NOT NULL ,
 `content_format` ENUM( 'html', 'text' ) NOT NULL ,
 `comment_allowed` TINYINT( 1 ) DEFAULT '0' NOT NULL ,
 `hidden` TINYINT( 1 ) NOT NULL ,
 PRIMARY KEY ( `id` ) ,
 UNIQUE (
`date_and_time` 
)
) COMMENT = 'Billets du blog';

/*
create table BlogCategory {
id char(36) not null,
name varchar(100) not null,
unique (id),
unique (name),
primary key (id)
}
*/
CREATE TABLE `BlogCategory` (
 `id` CHAR( 36 ) NOT NULL ,
 `name` VARCHAR( 100 ) NOT NULL ,
 UNIQUE (
`name` 
)
);

/*
create table BlogEntryCategory {
entry_id char(36) not null,
category_id char(36) not null,
unique (entry_id, category_id),
primary key (entry_id, category_id)
}
*/CREATE TABLE `BlogEntryCategory` (
 `entry_id` CHAR( 36 ) NOT NULL ,
 `category_id` CHAR( 36 ) NOT NULL ,
 PRIMARY KEY ( `entry_id` , `category_id` ) 
);

/*
create table BlogComment {
id char(36) not null,
parent_entry_id char(36) not null,
parent_comment_id char(36), /* Si null, commentaire direct sur Entry */
date_and_time char(14) not null,
title varchar(250) not null,
content text not null,
hide tinyint(1),
}
*/
CREATE TABLE `BlogComment` (
 `id` CHAR( 36 ) NOT NULL ,
 `parent_entry_id` CHAR( 36 ) NOT NULL ,
 `parent_comment_id` CHAR( 36 ) ,
 `date_and_time` CHAR( 14 ) NOT NULL ,
 `title` VARCHAR( 250 ) NOT NULL ,
 `content` TEXT NOT NULL ,
 `content_format` ENUM( 'html', 'text' ) DEFAULT 'html' NOT NULL ,
 `hidden` TINYINT( 1 ) DEFAULT '0' NOT NULL ,
 PRIMARY KEY ( `id` ) ,
 INDEX ( `parent_entry_id` , `parent_comment_id` ) 
);

 /*
create table BlogFormat {
id char(36) not null,
name varchar(100),
unique (id),
unique (name),
primary key (id)
}
*/