cms.sql 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. /* Create Tables */
  2. -- 文章表
  3. CREATE TABLE [js_cms_article]
  4. (
  5. [id] varchar(64) NOT NULL,
  6. [category_code] varchar(64) NOT NULL,
  7. [module_type] varchar(50),
  8. [title] nvarchar(255) NOT NULL,
  9. [href] nvarchar(1000),
  10. [color] varchar(50),
  11. [image] nvarchar(1000),
  12. [keywords] nvarchar(500),
  13. [description] nvarchar(500),
  14. [weight] decimal(10) DEFAULT 0,
  15. [weight_date] datetime,
  16. [source] char(1),
  17. [copyfrom] nvarchar(255),
  18. [hits] decimal(20) DEFAULT 0,
  19. [hits_plus] numeric(10),
  20. [hits_minus] numeric(10),
  21. [word_count] numeric(10),
  22. [custom_content_view] varchar(255),
  23. [view_config] nvarchar(1000),
  24. [status] char(1) DEFAULT '0' NOT NULL,
  25. [create_by] varchar(64) NOT NULL,
  26. [create_date] datetime NOT NULL,
  27. [update_by] varchar(64) NOT NULL,
  28. [update_date] datetime NOT NULL,
  29. [remarks] nvarchar(500),
  30. [corp_code] varchar(64) DEFAULT '0' NOT NULL,
  31. [corp_name] nvarchar(100) DEFAULT 'JeeSite' NOT NULL,
  32. PRIMARY KEY ([id])
  33. );
  34. -- 文章详情表
  35. CREATE TABLE [js_cms_article_data]
  36. (
  37. [id] varchar(64) NOT NULL,
  38. [content] text,
  39. [relation] varchar(1000),
  40. [is_can_comment] char(1),
  41. [extend_s1] nvarchar(500),
  42. [extend_s2] nvarchar(500),
  43. [extend_s3] nvarchar(500),
  44. [extend_s4] nvarchar(500),
  45. [extend_s5] nvarchar(500),
  46. [extend_s6] nvarchar(500),
  47. [extend_s7] nvarchar(500),
  48. [extend_s8] nvarchar(500),
  49. [extend_i1] decimal(19),
  50. [extend_i2] decimal(19),
  51. [extend_i3] decimal(19),
  52. [extend_i4] decimal(19),
  53. [extend_f1] decimal(19,4),
  54. [extend_f2] decimal(19,4),
  55. [extend_f3] decimal(19,4),
  56. [extend_f4] decimal(19,4),
  57. [extend_d1] datetime,
  58. [extend_d2] datetime,
  59. [extend_d3] datetime,
  60. [extend_d4] datetime,
  61. PRIMARY KEY ([id])
  62. );
  63. -- 文章推荐位
  64. CREATE TABLE [js_cms_article_posid]
  65. (
  66. [article_id] varchar(64) NOT NULL,
  67. [postid] char(1) NOT NULL
  68. );
  69. -- 文章与标签关系
  70. CREATE TABLE [js_cms_article_tag]
  71. (
  72. [article_id] varchar(64) NOT NULL,
  73. [tag_name] nvarchar(200) NOT NULL
  74. );
  75. -- 栏目表
  76. CREATE TABLE [js_cms_category]
  77. (
  78. [category_code] varchar(64) NOT NULL,
  79. [parent_code] varchar(64) NOT NULL,
  80. [parent_codes] varchar(767) NOT NULL,
  81. [tree_sort] decimal(10) NOT NULL,
  82. [tree_sorts] varchar(767) NOT NULL,
  83. [tree_leaf] char(1) NOT NULL,
  84. [tree_level] decimal(4) NOT NULL,
  85. [tree_names] nvarchar(767) NOT NULL,
  86. [category_name] nvarchar(100) NOT NULL,
  87. [site_code] varchar(64) NOT NULL,
  88. [module_type] varchar(50),
  89. [image] varchar(255),
  90. [href] varchar(255),
  91. [target] varchar(20),
  92. [keywords] nvarchar(500),
  93. [description] nvarchar(500),
  94. [in_menu] char(1),
  95. [in_list] char(1),
  96. [show_modes] char(1),
  97. [is_need_audit] char(1),
  98. [is_can_comment] char(1),
  99. [custom_list_view] varchar(255),
  100. [custom_content_view] varchar(255),
  101. [view_config] nvarchar(1000),
  102. [status] char(1) DEFAULT '0' NOT NULL,
  103. [create_by] varchar(64) NOT NULL,
  104. [create_date] datetime NOT NULL,
  105. [update_by] varchar(64) NOT NULL,
  106. [update_date] datetime NOT NULL,
  107. [remarks] nvarchar(500),
  108. [extend_s1] nvarchar(500),
  109. [extend_s2] nvarchar(500),
  110. [extend_s3] nvarchar(500),
  111. [extend_s4] nvarchar(500),
  112. [extend_s5] nvarchar(500),
  113. [extend_s6] nvarchar(500),
  114. [extend_s7] nvarchar(500),
  115. [extend_s8] nvarchar(500),
  116. [extend_i1] decimal(19),
  117. [extend_i2] decimal(19),
  118. [extend_i3] decimal(19),
  119. [extend_i4] decimal(19),
  120. [extend_f1] decimal(19,4),
  121. [extend_f2] decimal(19,4),
  122. [extend_f3] decimal(19,4),
  123. [extend_f4] decimal(19,4),
  124. [extend_d1] datetime,
  125. [extend_d2] datetime,
  126. [extend_d3] datetime,
  127. [extend_d4] datetime,
  128. PRIMARY KEY ([category_code])
  129. );
  130. -- 栏目与角色关联表
  131. CREATE TABLE [js_cms_category_role]
  132. (
  133. [category_code] varchar(64) NOT NULL,
  134. [role_code] varchar(64) NOT NULL,
  135. [ctrl_type] varchar(32),
  136. PRIMARY KEY ([category_code], [role_code])
  137. );
  138. -- 文章评论表
  139. CREATE TABLE [js_cms_comment]
  140. (
  141. [id] varchar(64) NOT NULL,
  142. [category_code] varchar(64) NOT NULL,
  143. [article_id] varchar(64) NOT NULL,
  144. [parent_id] varchar(64),
  145. [article_title] nvarchar(255) NOT NULL,
  146. [content] nvarchar(255) NOT NULL,
  147. [name] nvarchar(50),
  148. [ip] varchar(100),
  149. [create_by] varchar(64),
  150. [create_date] datetime NOT NULL,
  151. [audit_user_code] varchar(64),
  152. [audit_date] datetime,
  153. [audit_comment] nvarchar(200),
  154. [hits_plus] numeric(10),
  155. [hits_minus] numeric(10),
  156. [status] char(1) NOT NULL,
  157. [corp_code] varchar(64) DEFAULT '0' NOT NULL,
  158. [corp_name] nvarchar(100) DEFAULT 'JeeSite' NOT NULL,
  159. PRIMARY KEY ([id])
  160. );
  161. -- 留言板表
  162. CREATE TABLE [js_cms_guestbook]
  163. (
  164. [id] varchar(64) NOT NULL,
  165. [type] char(1) NOT NULL,
  166. [content] varchar(255) NOT NULL,
  167. [name] varchar(100) NOT NULL,
  168. [email] varchar(100) NOT NULL,
  169. [phone] varchar(100) NOT NULL,
  170. [workunit] varchar(100) NOT NULL,
  171. [ip] varchar(100) NOT NULL,
  172. [create_by] varchar(64),
  173. [create_date] datetime,
  174. [re_user_code] varchar(64),
  175. [re_date] datetime,
  176. [re_content] varchar(100),
  177. [status] char(1) NOT NULL,
  178. [corp_code] varchar(64) DEFAULT '0' NOT NULL,
  179. [corp_name] nvarchar(100) DEFAULT 'JeeSite' NOT NULL,
  180. PRIMARY KEY ([id])
  181. );
  182. -- 内容举报表
  183. CREATE TABLE [js_cms_report]
  184. (
  185. [id] varchar(64) NOT NULL,
  186. [report_source] char(1),
  187. [report_content] nvarchar(500),
  188. [report_url] nvarchar(1000),
  189. [report_type] char(1),
  190. [report_cause] nvarchar(500),
  191. PRIMARY KEY ([id])
  192. );
  193. -- 站点表
  194. CREATE TABLE [js_cms_site]
  195. (
  196. [site_code] varchar(64) NOT NULL,
  197. [site_name] nvarchar(100) NOT NULL,
  198. [site_sort] decimal(10),
  199. [title] nvarchar(100) NOT NULL,
  200. [logo] nvarchar(1000),
  201. [domain] nvarchar(500),
  202. [keywords] nvarchar(500),
  203. [description] nvarchar(500),
  204. [theme] nvarchar(500),
  205. [copyright] nvarchar(1000),
  206. [custom_index_view] varchar(500),
  207. [status] char(1) DEFAULT '0' NOT NULL,
  208. [create_by] varchar(64) NOT NULL,
  209. [create_date] datetime NOT NULL,
  210. [update_by] varchar(64) NOT NULL,
  211. [update_date] datetime NOT NULL,
  212. [remarks] nvarchar(500),
  213. PRIMARY KEY ([site_code])
  214. );
  215. -- 内容标签
  216. CREATE TABLE [js_cms_tag]
  217. (
  218. [tag_name] nvarchar(200) NOT NULL,
  219. [clicknum] numeric(10) NOT NULL,
  220. PRIMARY KEY ([tag_name])
  221. );
  222. -- 访问日志表
  223. CREATE TABLE [js_cms_visit_log]
  224. (
  225. [id] varchar(64) NOT NULL,
  226. [request_url] nvarchar(1000),
  227. [request_url_host] varchar(128),
  228. [source_referer] nvarchar(1000),
  229. [source_referer_host] varchar(128),
  230. [source_type] char(1),
  231. [search_engine] varchar(200),
  232. [search_word] nvarchar(200),
  233. [remote_addr] varchar(50),
  234. [user_agent] nvarchar(500),
  235. [user_language] varchar(32),
  236. [user_screen_size] varchar(32),
  237. [user_device] varchar(32),
  238. [user_os_name] varchar(32),
  239. [user_browser] varchar(32),
  240. [user_browser_version] varchar(16),
  241. [unique_visit_id] varchar(64),
  242. [visit_date] char(8),
  243. [visit_time] datetime,
  244. [is_new_visit] char(1),
  245. [first_visit_time] decimal(20),
  246. [prev_remain_time] decimal(20),
  247. [total_remain_time] decimal(20),
  248. [site_code] varchar(64),
  249. [site_name] nvarchar(100),
  250. [category_code] varchar(64),
  251. [category_name] nvarchar(100),
  252. [content_id] varchar(64),
  253. [content_title] nvarchar(255),
  254. [visit_user_code] varchar(100),
  255. [visit_user_name] varchar(100),
  256. [corp_code] varchar(64) DEFAULT '0' NOT NULL,
  257. [corp_name] nvarchar(100) DEFAULT 'JeeSite' NOT NULL,
  258. PRIMARY KEY ([id])
  259. );
  260. /* Create Indexes */
  261. CREATE INDEX [idx_cms_article_cb] ON [js_cms_article] ([create_by]);
  262. CREATE INDEX [idx_cms_article_cc] ON [js_cms_article] ([category_code]);
  263. CREATE INDEX [idx_cms_article_corp_code] ON [js_cms_article] ([corp_code]);
  264. CREATE INDEX [idx_cms_article_status] ON [js_cms_article] ([status]);
  265. CREATE INDEX [idx_cms_article_ud] ON [js_cms_article] ([update_date]);
  266. CREATE INDEX [idx_cms_article_weight] ON [js_cms_article] ([weight]);
  267. CREATE INDEX [idx_cms_category_pc] ON [js_cms_category] ([parent_code]);
  268. CREATE INDEX [idx_cms_category_ts] ON [js_cms_category] ([tree_sort]);
  269. CREATE INDEX [idx_cms_category_status] ON [js_cms_category] ([status]);
  270. CREATE INDEX [idx_cms_category_tss] ON [js_cms_category] ([tree_sorts]);
  271. CREATE INDEX [idx_cms_comment_catc] ON [js_cms_comment] ([category_code]);
  272. CREATE INDEX [idx_cms_comment_ai] ON [js_cms_comment] ([article_id]);
  273. CREATE INDEX [idx_cms_comment_cc] ON [js_cms_comment] ([corp_code]);
  274. CREATE INDEX [idx_cms_comment_status] ON [js_cms_comment] ([status]);
  275. CREATE INDEX [idx_cms_guestbook_cc] ON [js_cms_guestbook] ([corp_code]);
  276. CREATE INDEX [idx_cms_guestbook_status] ON [js_cms_guestbook] ([status]);
  277. CREATE INDEX [idx_cms_guestbook_type] ON [js_cms_guestbook] ([type]);
  278. CREATE INDEX [idx_cms_site_status] ON [js_cms_site] ([status]);
  279. CREATE INDEX [cms_visit_log_cc] ON [js_cms_visit_log] ([category_code]);
  280. CREATE INDEX [cms_visit_log_ci] ON [js_cms_visit_log] ([content_id]);
  281. CREATE INDEX [cms_visit_log_fvt] ON [js_cms_visit_log] ([first_visit_time]);
  282. CREATE INDEX [cms_visit_log_inv] ON [js_cms_visit_log] ([is_new_visit]);
  283. CREATE INDEX [cms_visit_log_ra] ON [js_cms_visit_log] ([remote_addr]);
  284. CREATE INDEX [cms_visit_log_sc] ON [js_cms_visit_log] ([site_code]);
  285. CREATE INDEX [cms_visit_log_uvid] ON [js_cms_visit_log] ([unique_visit_id]);
  286. CREATE INDEX [cms_visit_log_vd] ON [js_cms_visit_log] ([visit_date]);
  287. CREATE INDEX [cms_visit_log_vt] ON [js_cms_visit_log] ([visit_time]);
  288. CREATE INDEX [idx_cms_visit_log_corpc] ON [js_cms_visit_log] ([corp_code]);