 DROP TABLE IF EXISTS blog_love;
 
 CREATE TABLE blog_love (
-  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 '更新时间',
-  blog_id        INT       NOT NULL
+  blog_id        INT
   COMMENT 'blogID',
-  web_visitor_id INT       NOT NULL
+  web_visitor_id INT
   COMMENT '访客ID',
   PRIMARY KEY (id)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='blog喜欢表';

DROP TABLE IF EXISTS friend_link;

CREATE TABLE friend_link (
  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 '更新时间',
  friend_name VARCHAR(45) NOT NULL
  COMMENT '朋友名',
  url         VARCHAR(64) NOT NULL DEFAULT '#'
  COMMENT '友情链接',
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='友情链接表';


CREATE TABLE blog (
	id INT NOT NULL AUTO_INCREMENT COMMENT '主键',
	create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  publish_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '发布时间',
  category_id INT COMMENT '分类id',
	title VARCHAR(128) COMMENT '文章标题',
	blog_md TEXT COMMENT 'blog的md格式文本',
	read_times INT(11) COMMENT '阅读次数',
  comment_times INT(11) COMMENT '评论次数',
	love_times INT(11) COMMENT '喜欢次数',
	status TINYINT(1) 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         AUTO_INCREMENT
  COMMENT '主键',
  create_time   TIMESTAMP   DEFAULT CURRENT_TIMESTAMP
  COMMENT '创建时间',
  update_time   TIMESTAMP   DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
  COMMENT '更新时间',
  category_name VARCHAR(20) COMMENT 'blog类名',
  PRIMARY KEY (id)
)  ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='blog分类表';

