基于ssm框架的个人博客(1)--数据表的设计

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/lys1695227550/article/details/78110945
    感觉学习javaweb也有一段时日了,是时候自己动手做点什么了,既然写起了博客,那就从个人博客系统写起。

千里之行始于足下。

第一步数据库的设计,设计的时候总是出现觉得自己缺点什么,最后综合好几份博客系统的代码,部分有sql文件,最终通过powerDesign生成下面的blog.sql文件

大致浏览下图,便可了解数据库中的表的结构(实体完整性规则、参照完整性规则与用户自定义规则)。

具体的可以自行做出修改。



/*==============================================================*/
/* DBMS name:      MySQL 5.0                                    */
/* Created on:     2017/9/29 13:26:31                           */
/*==============================================================*/


drop table if exists t_blog;

drop table if exists t_blogType;

drop table if exists t_blogger;

/*==============================================================*/
/* Table: t_blog                                                */
/*==============================================================*/
create table t_blog
(
   id                   int not null comment '博客id',
   title                varchar(200) not null comment '博客题目',
   summary              varchar(400) comment '博客摘要',
   releaseDate          datetime comment '发布日期',
   clickHit             int comment '评论次数',
   replyHit             int comment '回复次数',
   content              text comment '博客内容',
   keyWord              varchar(200) comment '关键字',
   type_id              int comment '外键关联博客类别',
   primary key (id)
)
charset = UTF8;

/*==============================================================*/
/* Table: t_blogType                                            */
/*==============================================================*/
create table t_blogType
(
   id                   int not null comment '博客类型',
   typeName             varchar(30) comment '博客类别',
   orderNum             int comment '博客排序',
   primary key (id)
)
charset = UTF8;

/*==============================================================*/
/* Table: t_blogger                                             */
/*==============================================================*/
create table t_blogger
(
   id                   int not null auto_increment comment '博主id',
   username             varchar(50) not null comment '博主姓名',
   password             varchar(80) not null comment '博主密码',
   info                 text comment '博主信息',
   nickname             varchar(50) comment '博主昵称',
   sign                 varchar(100) comment '博主签名',
   imagePath            varchar(100) comment '博主头像路径',
   primary key (id)
)
charset = UTF8;

alter table t_blog add constraint FK_type_id foreign key (id)
      references t_blogType (id) on delete restrict on update restrict;  

在这我使用的是Navicat for MySQL作为数据库管理工具,并在此上运行sql代码,创建数据库。

接着就开始在mysql中部署。


接着,我们来整合一下ssm框架,下文正在编辑中......

猜你喜欢

转载自blog.csdn.net/lys1695227550/article/details/78110945