 DROP TABLE IF EXISTS friend_link;
 
 CREATE TABLE friend_link (
-  id          INT         NOT NULL AUTO_INCREMENT
+  id          INT         AUTO_INCREMENT
   COMMENT '主键',
-  create_time TIMESTAMP   NOT NULL DEFAULT CURRENT_TIMESTAMP
+  create_time TIMESTAMP   DEFAULT CURRENT_TIMESTAMP
   COMMENT '创建时间',
-  update_time TIMESTAMP   NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+  update_time TIMESTAMP   DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
   COMMENT '更新时间',
-  friend_name VARCHAR(45) NOT NULL
+  friend_name VARCHAR(45)
   COMMENT '朋友名',
-  url         VARCHAR(64) NOT NULL DEFAULT '#'
+  url         VARCHAR(64) DEFAULT '#'
   COMMENT '友情链接',
   PRIMARY KEY (id)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='友情链接表';


CREATE TABLE blog (
	id INT NOT NULL AUTO_INCREMENT COMMENT '主键',
	create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  publish_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '发布时间',
  category_id INT NOT NULL COMMENT '分类id',
	title VARCHAR(128) NOT NULL COMMENT '文章标题',
	blog_md TEXT NOT NULL COMMENT 'blog的md格式文本',
#   blog_html TEXT NOT NULL COMMENT 'blog的html格式文本',
	read_times INT(11) NOT NULL COMMENT '阅读次数',
  comment_times INT(11) NOT NULL COMMENT '评论次数',
	love_times INT(11) NOT NULL COMMENT '喜欢次数',
	status TINYINT(1) NOT NULL DEFAULT 0 COMMENT '状态:0,草稿 1,发布 2,删除',
	PRIMARY KEY (id)
)  ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户blog表';

DROP TABLE IF EXISTS blog_category;

CREATE TABLE blog_category (
  id            INT         NOT NULL AUTO_INCREMENT
  COMMENT '主键',
  create_time   TIMESTAMP   NOT NULL DEFAULT CURRENT_TIMESTAMP
  COMMENT '创建时间',
  update_time   TIMESTAMP   NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
  COMMENT '更新时间',
  category_name VARCHAR(20) NOT NULL
  COMMENT 'blog类名',
  PRIMARY KEY (id)
)  ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='blog分类表';


DROP TABLE IF EXISTS blog_comment;

CREATE TABLE blog_comment (
	id INT AUTO_INCREMENT COMMENT '主键',
	create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
	web_visitor_id INT COMMENT '访客id',
	blog_id INT COMMENT '文章ID',
	comment VARCHAR(2000) COMMENT '评论内容',
	reply_comment_id INT(11) COMMENT '父级评论',
  parents_comment_id VARCHAR(128) DEFAULT '0,' COMMENT '父级评论路径',
	PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='blog评论表';
