if exists(select top 1 * from dbo.sysobjects where id = object_id(N'[dbo].[srcs]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table srcs
create table srcs(
id bigint not null identity(1,1) primary key,
created datetime not null default getdate(),
modified datetime not null default getdate(),
title varchar(500) ,--资源主题,对于文件来说,一般来自原始资源的文件名
ext varchar(50) not null ,--资源的类型属性,对于文件来说,
spec varchar(50) ,--文件规格,比如用于表征该文件的手机适配等w176 宽度176WAP图片
fsize bigint ,--文件大小
server_id int default 1 not null ,--资源使用的服务器
rStr varchar(50) not null ,--randomString关联提取字符串,也用于文件定位,不能随意进行修改
state tinyint ,--状态
custom_id bigint default 1 not null ,--添加资源的用户ID
cIP varchar(30) not null ,--资源的IP
)
if exists(select top 1 * from dbo.sysobjects where id = object_id(N'[dbo].[pages]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table pages
create table pages(
id bigint not null identity(1,1) primary key,
created datetime not null default getdate(),
modified datetime not null default getdate(),
title varchar(500) Not null ,--页面主题,用于title已经其他搜索内容
state int default 0 not null ,--页面状态 0正常 1屏蔽 2镜像页面,可在Page2Page表中找到镜像
maked datetime ,--上次生成时间
custom_id bigint default 0 not null ,--添加该页面的用户ID
lastCustom_id bigint default 0 not null ,--最后编辑该页面的用户ID
)
if exists(select top 1 * from dbo.sysobjects where id = object_id(N'[dbo].[src2pages]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table src2pages
create table src2pages(
id bigint not null identity(1,1) primary key,
created datetime not null default getdate(),
modified datetime not null default getdate(),
page_id bigint not null,
src_id bigint not null,
state int default 0 not null ,
rowSN int default 50 not null,
foreign key (page_id) references pages(id) on delete cascade,
foreign key (src_id) references srcs(id) on delete cascade,
);
create index idx_src2Page_Page_ID on src2pages(page_id)
if exists(select top 1 * from dbo.sysobjects where id = object_id(N'[dbo].[src2srcs]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table src2srcs
create table src2srcs(
id bigint not null identity(1,1) primary key,
created datetime not null default getdate(),
modified datetime not null default getdate(),
oID bigint Not null ,--K,src_id
tID bigint not null ,--K,src_id
spec varchar(50) Not null
foreign key (oID) references srcs(id) on delete cascade,
);
create index idx_src2Page_oID on src2srcs(oID)
if exists(select top 1 * from dbo.sysobjects where id = object_id(N'[dbo].[customs]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table customs
create table customs(
id bigint not null identity(1,1) primary key,
created datetime not null default getdate(),
modified datetime not null default getdate(),
email varchar(200) not null ,--邮件
pwd varchar(400) not null ,--密码MD5加密
state tinyint default 0 not null ,--0:正常1:停用
);
create unique index idx_customs_email on customs(email)
insert customs (email,pwd) values ('匿名用户','121')
if exists(select top 1 * from dbo.sysobjects where id = object_id(N'[dbo].[pageLogs]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table pageLogs
create table pageLogs(
id bigint not null identity(1,1) primary key,
created datetime not null default getdate(),
modified datetime not null default getdate(),
page_id bigint not null,
custom_id bigint not null default 0,
page_modified datetime not null,
);
create index idx_pageLogs_pageID on pageLogs(page_id)
if exists(select top 1 * from dbo.sysobjects where id = object_id(N'[dbo].[src2pageLogs]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table src2pageLogs
create table src2pageLogs(
id bigint not null identity(1,1) primary key,
created datetime not null default getdate(),
modified datetime not null default getdate(),
page_id bigint not null,
src_id bigint not null,
state int default 0 not null ,
rowSN int default 50 not null,
pageLog_id bigint not null,
foreign key (page_id) references pages(id) on delete cascade,
foreign key (src_id) references srcs(id) on delete cascade,
foreign key (pageLog_id) references pageLogs(id) on delete cascade,
);
create index idx_src2PageLogs_Page_ID on src2pageLogs(page_id)
if exists(select top 1 * from dbo.sysobjects where id = object_id(N'[dbo].[sysCons]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table sysCons
create table sysCons(
id bigint not null identity(1,1) primary key,
created datetime not null default getdate(),
modified datetime not null default getdate(),
title varchar(200) not null ,--标题
detail varchar(500) ,--描述
managerID bigint ,--上次修改的管理员ID
cIP varchar(30) not null ,--修改者IP
);
insert sysCons (title,detail,managerID,cIP) values ('adminID',2,2,'127.0.0.1')
if exists(select top 1 * from dbo.sysobjects where id = object_id(N'[dbo].[tags]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table tags
create table tags(
id bigint not null identity(1,1) primary key,
created datetime not null default getdate(),
modified datetime not null default getdate(),
title varchar(200) not null ,--标题
cLevel varchar(400) ,--
state tinyint default 0 not null ,--修改者IP
);
create unique index idx_tag_title on tags(title)
if exists(select top 1 * from dbo.sysobjects where id = object_id(N'[dbo].[page2tags]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table page2tags
create table page2tags(
id bigint not null identity(1,1) primary key,
created datetime not null default getdate(),
modified datetime not null default getdate(),
page_id bigint not null,
tag_id bigint not null,
state tinyint default 0 not null ,
foreign key (page_id) references pages(id) on delete cascade,
foreign key (tag_id) references tags(id) on delete cascade,
);
create unique index idx_page2tag_page_ID_tag_id on page2tags(page_id,tag_id)
资源表
| id | bigint | identity(1,1) | Primary key | |
| created | datetime | default getdate | not null | ,--注意同时用于资源文件的定位,因此在创建以后不能随意进行更改。 |
| modified | datetime | default getdate | not null | ,--在本系统里面基本没有什么用 |
| title | varchar(500) | ,--资源主题,对于文件来说,一般来自原始资源的文件名 | ||
| ext | varchar(50) | not null | ,--资源的类型属性,对于文件来说, 现阶段:JPG\TXT\WMV |
|
| spec | varchar(50) | ,--文件规格,比如用于表征该文件的手机适配等 w176 宽度176WAP图片 n400 正式预览图 |
||
| fsize | bigint | ,--文件大小 | ||
| server_id | int | default 1 | not null | ,--资源使用的服务器 |
| rStr | varchar(50) | not null | ,--randomString关联提取字符串,也用于文件定位,不能随意进行修改 | |
| state | tinyint | ,--状态 0资源原始状态 1资源正常状态 2资源备份中 3资源正在从备份中重建 |
||
| custom_id | bigint | default 1 | not null | ,--添加资源的用户ID |
| cIP | varchar(30) | not null | ,--资源的IP |
编辑以上内容 删除以上内容 追加资源
| id | bigint | identity(1,1) | Not null | primary key, |
| created | datetime | default now | Not null | , |
| modified | datetime | default now | Not null | , |
| title | varchar(500) | Not null | ,--页面主题,用于title已经其他搜索内容 | |
| state | int | default 0 | ,--页面状态 0正常 1屏蔽 2镜像页面,可在Page2Page表中找到镜像 |
|
| maked | datetime | ,--上次生成时间 | ||
| custom_id | bigint | default 1 | Not null | ,--添加该页面的用户ID |
| lastCustom_id | bigint | default 1 | not null | ,--最后编辑该页面用户ID |
| id | bigint | identity(1,1) | Not null | primary key, |
| created | datetime | default now | Not null | |
| modified | datetime | default now | Not null | |
| page_id | bigint | Not null | ,--K,将来SQL server中升级为FK,idxs | |
| src_id | bigint | not null | ,--K,将来有可能升级为多表的引用~~~~~~~ 现在引用srcMain |
|
| state | int | default 0 | Not null | ,--页面内容描述: 0:默认 1:预览 2:下载 3:图片环绕 4:图片背景 |
| rowSN | int | default 50 | not null | ,--行序号 |
| id | bigint | identity(1,1) | Not null | primary key, |
| created | datetime | default now | Not null | |
| modified | datetime | default now | Not null | |
| page_id | bigint | Not null | ,--K,将来SQL server中升级为FK,idxs | |
| src_id | bigint | not null | ,--K,将来有可能升级为多表的引用~~~~~~~ 现在引用srcMain |
|
| state | int | default 0 | Not null | ,--页面内容描述: 0:默认 1:预览 2:下载 3:图片环绕 4:图片背景 |
| rowSN | int | default 50 | not null | ,--行序号 |
| pageLog_id | bigint | not null | ,--K,页更新编号 |
| id | bigint | identity(1,1) | Not null | primary key, |
| created | datetime | default now | Not null | |
| modified | datetime | default now | Not null | |
| oID | bigint | Not null | ,--K,src_id | |
| tID | bigint | not null | ,--src_id | |
| spec | varchar(50) | Not null | ,--规格对应关系 |
| id | bigint | identity(1,1) | not null | primary key |
| created | datetime | getdate | Not null | |
| modified | datetime | |||
| title | varchar(50) | not null | 登陆名 | |
| pwd | varchar(500) | not null | 密码 | |
| state | int | 0 | not null | 0:等待审核 1:正常 2:停用 |
| detail | varchar(255) | not null | 描述 | |
| levels | varchar(80) | default '0000' | not null | 4位唯一字符串描述用户的等级,用于用户的审核和分组,被审核对象位数为审核者位数+4,拥有用户管理权限的用户,可以向本层次用户添加权限(不能回收权限),可以向下一层次用户添加或回收权限。 |
| defaultCP | int | default 0 | 默认CP_ID |
|
sysCons 配置表 |
| id | bigint | identity(1,1) | Primary key | |
| created | datetime | default getdate | not null | ,-- |
| modified | datetime | default getdate | not null | ,-- |
| title | varchar(200) | not null | ,--标题 | |
| detail | varchar(500) | ,--描述 | ||
| managerID | bigint | ,--上次修改的管理员ID | ||
| cIP | varchar(30) | not null | ,--修改者IP |
|
title=adminID时,detail=custom_id,给定表默认数据 insert sysCons (title,detail,managerID,cIP) values ('adminID',2,2,'127.0.0.1') |
|
customs 用户表;insert 默认数据 匿名用户 ID=1 |
| id | bigint | identity(1,1) | primary key, | |
| created | datetime | default getdate | not null | , |
| modified | datetime | default getdate | not null | , |
| varchar(200) | not null | ,--邮件 | ||
| pwd | varchar(100) | not null | ,--密码MD5加密 | |
| state | tinyint | default 0 | not null | ,--0:正常1:停用 |
|
pageLogs 用户表 |
| id | bigint | identity(1,1) | primary key, | |
| created | datetime | default getdate | not null | , |
| modified | datetime | default getdate | not null | , |
| page_id | bigint | not null | ,--页面ID not PK | |
| custom_id | bigint | default 1 | not null | ,--用户ID not PK |
| page_modified | datetime | not null | ,--页面修改时间 |
|
tags 标签表 |
| id | bigint | identity(1,1) | primary key, | |
| created | datetime | default getdate | not null | , |
| modified | datetime | default getdate | not null | , |
| title | varchar(200) | not null | ,--标签名称,unique index | |
| cLevel | varchar(400) | ,--Level等级 | ||
| state | tinyint | default 0 | not null | ,--状态 |
|
page2tags 页面标签关系表 |
| id | bigint | identity(1,1) | primary key, | |
| created | datetime | default getdate | not null | , |
| modified | datetime | default getdate | not null | , |
| page_id | bigint | not null | ,--PK | |
| tag_id | bigint | not null | ,--PK | |
| state | tinyint | default 0 | not null | ,--状态 |
|
page_id tag_id unique index |