ShareInfo.sql 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. -- =============================================
  2. -- 程序编写: Jeff
  3. -- 版 本: V 1.0
  4. -- 建立日期: 2015-04-09
  5. -- 功能说明: 创建共享表[NetShareInfo],大店使用相片存储时,往往4T硬盘存储不下相片原片,所以要多个同类型共享目录存储;
  6. -- 备 注:
  7. -- 修改日期:
  8. -- 修改说明:
  9. -- =============================================
  10. use [db]
  11. go
  12. set ansi_nulls on
  13. go
  14. set quoted_identifier on
  15. go
  16. set ansi_padding on
  17. go
  18. --判断表是否存在,不存在则创建;
  19. if not exists(select * from dbo.sysobjects where id = object_id(N'NetShareInfo') and objectproperty(id,'IsTable') = 1)
  20. begin
  21. create table [dbo].[NetShareInfo](
  22. [enable] [bit] default(1) not null, /* 启动状态:false禁用,true启用 */
  23. [branchid] [nvarchar](32) null, /* 分店域名 */
  24. [enable] [bit] default(1) not null, /* 启动状态:false禁用,true启用 */
  25. [shareHost] [nvarchar](16) not null, /* 共享主机名 --有冗余*/
  26. [sharePath] [nvarchar](16) not null, /* 共享目录名 */
  27. [mincapacity] [tinyint] default(30) not null, /* 共享目录所在硬盘的最小可用容量(单位G byte),当实际可用容量值小于该值时,停止使用硬盘 */
  28. [maxcapacity] [tinyint] default(30) not null, /* 共享目录所在硬盘的最大可用容量(单位G byte),当实际可用容量值小于该值时,使用下一共享目录 */
  29. [photoType] [tinyint] not null, /* 共享相片类型:原片==1,初修片==2,精修片==3,设计片==4,原片备份==5,初修备份==6,精修备份==7,设计备份==8 */
  30. [priority] [tinyint] default(1) not null, /* 某分店下,相同共享相片类型的多个共享目录的优先使用级别 */
  31. /* 联合主键:域名+共享主机名+共享目录名*/
  32. constraint [PK_NetShareinfo] primary key clustered
  33. (
  34. [branchid] asc,
  35. [shareHost] asc,
  36. [sharePath] asc
  37. ) with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on,allow_page_locks = on) on [primary],
  38. -- 设置UNIQUE约束;
  39. constraint [PK_NetShareInfo_U] unique nonclustered
  40. (
  41. [branchid] asc,
  42. [photoType] asc,
  43. [priority] asc
  44. ) with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on,allow_page_locks = on) on [primary]
  45. ) on [primary]
  46. end
  47. go
  48. --可用容量最小设置值为5G;
  49. alter table [dbo].[NetShareInfo] with check add check([mincapacity] >= 5)
  50. alter table [dbo].[NetShareInfo] with check add check([maxcapacity] >= 35)
  51. go
  52. --最低权限值为1,无上限;
  53. alter table [dbo].[NetShareInfo] with check add check([priority] >= 1)
  54. go
  55. set ansi_padding off