Blog 项目数据库脚本:因为本人更熟悉sqlserver 所以就没用mysql
CREATE TABLE [dbo].[BlogAuthPermission]
(
[PermissionId] BIGINT NOT NULL IDENTITY ,
[PermissionStr] NVARCHAR(64) NOT NULL,
[Status] INT NULL DEFAULT 0,
[Remark] NVARCHAR(256) NULL,
CONSTRAINT [PK_BlogAuthPermission] PRIMARY KEY ([PermissionId])
)
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'-1 特权角色,不能删除 0正常 1停用 2删除',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'BlogAuthPermission',
@level2type = N'COLUMN',
@level2name = N'Status'
CREATE TABLE [dbo].[BlogAuthRole]
(
[RoleId] BIGINT NOT NULL IDENTITY ,
[RoleName] NVARCHAR(50) NOT NULL,
[RoleKey] NVARCHAR(100) NOT NULL,
[Status] INT NOT NULL DEFAULT 0,
[Remark] NVARCHAR(512) NULL,
CONSTRAINT [PK_BlogAuthRole] PRIMARY KEY ([RoleId])
)
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'-1 特权角色,不能删除 0正常 1停用 2删除',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'BlogAuthRole',
@level2type = N'COLUMN',
@level2name = N'Status'
CREATE TABLE [dbo].[BlogAuthRolePermission]
(
[Id] BIGINT NOT NULL IDENTITY ,
[RoleId] BIGINT NOT NULL,
[PermissionId] BIGINT NOT NULL,
CONSTRAINT [PK_BlogAuthRolePermission] PRIMARY KEY ([Id])
)
CREATE TABLE [dbo].[BlogAuthUser]
(
[UserId] BIGINT NOT NULL IDENTITY ,
[UserName] NVARCHAR(50) NOT NULL,
[NickName] NVARCHAR(50) NOT NULL,
[Password] NVARCHAR(50) NULL ,
[Email] NVARCHAR(50) NULL ,
[Cellphone] NVARCHAR(50) NULL ,
[Gender] INT NOT NULL,
[Avatar] NVARCHAR(100) NULL ,
[Salt] NVARCHAR(20) NULL ,
[CreateTime] DATETIME NOT NULL DEFAULT getdate(),
[Status] INT NOT NULL DEFAULT 0,
[Remark] NVARCHAR(512) NULL,
CONSTRAINT [PK_BlogAuthUser] PRIMARY KEY ([UserId])
)
--用户信息表
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'0男 1女 2未知',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'BlogAuthUser',
@level2type = N'COLUMN',
@level2name = N'Gender'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'-1 特权用户不能删除 0正常 1禁用 2删除',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'BlogAuthUser',
@level2type = N'COLUMN',
@level2name = N'Status'
CREATE TABLE [dbo].[BlogAuthUserRole]
(
[Id] INT NOT NULL IDENTITY ,
[UserId] BIGINT NOT NULL,
[RoleId] BIGINT NOT NULL,
CONSTRAINT [PK_BlogAuthUserRole] PRIMARY KEY ([Id])
)
--用户和角色关联表
CREATE TABLE [dbo].[BlogComment]
(
[CommentId] BIGINT NOT NULL IDENTITY ,
[PostId] BIGINT NOT NULL,
[Content] TEXT NULL,
[CommentTime] TIME NULL,
[CommentIp] NVARCHAR(64) NULL,
[PID] NVARCHAR(64) NULL DEFAULT -1,
[UserId] BIGINT NOT NULL,
[UserName] NVARCHAR(64) NULL,
[NickName] NVARCHAR(64) NULL,
[Email] NVARCHAR(64) NULL,
[Status] INT NOT NULL DEFAULT 1,
CONSTRAINT [PK_BlogComment] PRIMARY KEY ([CommentId])
)
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'评论者的IP地址',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'BlogComment',
@level2type = N'COLUMN',
@level2name = N'CommentIp'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'父层评论的ID,用来实现评论盖楼效果',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'BlogComment',
@level2type = N'COLUMN',
@level2name = N'PID'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'评论状态:0:已删除;1:已发布;2:优质评论',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'BlogComment',
@level2type = N'COLUMN',
@level2name = N'Status'
CREATE TABLE [dbo].[BlogHibernateSequence]
(
[NextVal] BIGINT NOT NULL IDENTITY,
CONSTRAINT [PK_BlogHibernateSequence] PRIMARY KEY ([NextVal])
)
CREATE TABLE [dbo].[BlogParams]
(
[ParamKey] NVARCHAR(128) NOT NULL ,
[ParamValue] NVARCHAR(1024) NOT NULL,
[ParamDesc] NVARCHAR(512) NULL,
CONSTRAINT [PK_BlogParams] PRIMARY KEY ([ParamKey])
)--系统参数表
CREATE TABLE [dbo].[BlogPost]
(
[PostId] BIGINT NOT NULL IDENTITY ,
[BgImg] NVARCHAR(256) NULL,
[PostTitle] NVARCHAR(128) NOT NULL,
[PostTime] DATETIME NOT NULL,
[PostSummary] NVARCHAR(1024) NULL,
[PostContent] TEXT NULL,
[OriginalUrl] NVARCHAR(512) NULL,
[PostType] INT NOT NULL DEFAULT 0,
[LastModifyTime] DATETIME NULL ,
[ReadTimes] BIGINT NOT NULL DEFAULT 1,
[LikedTimes] BIGINT NOT NULL DEFAULT 0,
[CommentTimes] BIGINT NOT NULL DEFAULT 0,
[UserId] BIGINT NULL,
[Email] NVARCHAR(64) NULL,
[NickName] NVARCHAR(64) NULL,
[EnableComment] INT NULL,
[Status] INT NOT NULL DEFAULT 4,
CONSTRAINT [PK_BlogPost] PRIMARY KEY ([PostId])
)
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'缩略图链接',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'BlogPost',
@level2type = N'COLUMN',
@level2name = N'BgImg'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'摘要,文章列表页需要使用',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'BlogPost',
@level2type = N'COLUMN',
@level2name = N'PostSummary'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'内容',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'BlogPost',
@level2type = N'COLUMN',
@level2name = N'PostContent'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'原文链接,如果有这个字段,说明是翻译文章',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'BlogPost',
@level2type = N'COLUMN',
@level2name = N'OriginalUrl'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'文章的类型,0原创1翻译',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'BlogPost',
@level2type = N'COLUMN',
@level2name = N'PostType'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'阅读数',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'BlogPost',
@level2type = N'COLUMN',
@level2name = N'ReadTimes'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'点赞数',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'BlogPost',
@level2type = N'COLUMN',
@level2name = N'LikedTimes'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'评论数',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'BlogPost',
@level2type = N'COLUMN',
@level2name = N'CommentTimes'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'是否可评论
0不可
1可',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'BlogPost',
@level2type = N'COLUMN',
@level2name = N'EnableComment'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'状态:
1、已删除
2、已归档,已归档的内容禁止评论,文章不可删除
3、草稿
4、已发布
5、精华-->精华文章不可删除
6、已推至首页 ',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'BlogPost',
@level2type = N'COLUMN',
@level2name = N'Status'
CREATE TABLE [dbo].[BlogUpload]
(
[UpId] BIGINT NOT NULL IDENTITY ,
[UpTime] DATETIME NOT NULL DEFAULT getdate() ,
[FileName] NVARCHAR(128) NULL,
[FileType] NVARCHAR(16) NULL,
[FileWidth] INT NOT NULL DEFAULT 0,
[FileHeight] INT NOT NULL DEFAULT 0,
[FileSize] FLOAT NOT NULL DEFAULT 0,
[DisplayOrder] INT NOT NULL DEFAULT 0,
[UserId] BIGINT NOT NULL DEFAULT 0,
[FileModule] INT NOT NULL DEFAULT 1,
[FileDesc] NVARCHAR(128) NULL,
CONSTRAINT [PK_BlogUpload] PRIMARY KEY ([UpId])
)
--上传的文件,会员头像、用户头像、门店图片介绍、项目图片介绍等,所有上传的文件都记录在这张表。
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'与物理保存的文件名一致',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'BlogUpload',
@level2type = N'COLUMN',
@level2name = N'FileName'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'1、图片;\n 2、附件;',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'BlogUpload',
@level2type = N'COLUMN',
@level2name = N'FileType'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
@value = N'1、metro相关的图片
2、文章相关的图片
3、图书相关的图片
4、小图标
5、用户头像 ',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'BlogUpload',
@level2type = N'COLUMN',
@level2name = N'FileModule'