install.sql 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. # 创建Card数据表
  2. create table if not exists card
  3. (
  4. id int auto_increment
  5. primary key
  6. ) character set utf8mb4
  7. collate utf8mb4_general_ci comment '卡片数据表';
  8. alter table card
  9. add name varchar(200) null;
  10. alter table card
  11. add name_en varchar(200) null;
  12. alter table card
  13. add status int default 0 null;
  14. alter table card
  15. add version int default 0 null;
  16. alter table card
  17. add tips varchar(255) null comment '说明';
  18. alter table card
  19. add create_time datetime null comment '添加时间';
  20. alter table card
  21. add src text null comment 'logo';
  22. alter table card
  23. add url varchar(255) null comment '卡片地址';
  24. alter table card
  25. add `window` varchar(255) null comment '窗口地址';
  26. alter table card
  27. add update_time datetime null;
  28. alter table card
  29. add install_num int default 0 null;
  30. alter table card
  31. add setting varchar(200) null comment '设置页面的url';
  32. alter table card
  33. add dict_option longtext null comment '配置的参数';
  34. alter table card
  35. add constraint card_pk
  36. unique (name_en);
  37. create index card_name_en_index
  38. on card (name_en);
  39. #创建config数据表
  40. create table if not exists config
  41. (
  42. user_id int null
  43. ) character set utf8mb4
  44. collate utf8mb4_general_ci comment '用户配置数据表';
  45. create index config_user_id_index
  46. on config (user_id);
  47. alter table config
  48. add config longtext null;
  49. # 创建file数据表
  50. create table if not exists file
  51. (
  52. id bigint auto_increment
  53. primary key
  54. ) character set utf8mb4
  55. collate utf8mb4_general_ci comment '文件';
  56. alter table file
  57. add path varchar(255) null;
  58. alter table file
  59. add user_id int null;
  60. alter table file
  61. add create_time datetime null;
  62. alter table file
  63. add size double default 0 null comment '尺寸';
  64. alter table file
  65. add mime_type varchar(100) null comment '文件类型';
  66. alter table file
  67. add hash varchar(100) null comment '文件哈希';
  68. #创建history数据表
  69. create table if not exists history
  70. (
  71. id bigint auto_increment
  72. primary key,
  73. constraint history_id_uindex
  74. unique (id)
  75. ) character set utf8mb4
  76. collate utf8mb4_general_ci comment 'link历史数据';
  77. alter table history
  78. add user_id int null;
  79. alter table history
  80. add link longtext null;
  81. alter table history
  82. add create_time datetime null comment '创建时间';
  83. #创建link数据表
  84. create table if not exists link
  85. (
  86. user_id int null
  87. ) character set utf8mb4
  88. collate utf8mb4_general_ci;
  89. create index link_user_id_index
  90. on link (user_id);
  91. alter table link
  92. add update_time datetime null comment '更新时间';
  93. alter table link
  94. add link longtext null;
  95. #创建link_folder数据表
  96. create table if not exists link_folder
  97. (
  98. id int auto_increment comment 'id'
  99. primary key
  100. ) character set utf8mb4
  101. collate utf8mb4_general_ci comment '标签链接分类';
  102. alter table link_folder
  103. add name varchar(50) null comment '分类名称';
  104. alter table link_folder
  105. add sort int default 0 null;
  106. alter table link_folder
  107. add group_ids varchar(200) default '0' null comment '可见用户分组';
  108. #创建link_store数据表
  109. create table if not exists linkstore
  110. (
  111. id int auto_increment
  112. primary key,
  113. constraint linkStore_id_uindex
  114. unique (id)
  115. ) character set utf8mb4
  116. collate utf8mb4_general_ci;
  117. alter table linkstore
  118. add name varchar(255) null;
  119. alter table linkstore
  120. add src varchar(255) null;
  121. alter table linkstore
  122. add url text null;
  123. alter table linkstore
  124. add type varchar(20) default 'icon' null;
  125. alter table linkstore
  126. add size varchar(20) default '1x1' null;
  127. alter table linkstore
  128. add create_time datetime null;
  129. alter table linkstore
  130. add hot bigint default 0 null;
  131. alter table linkstore
  132. add area varchar(20) default '' null comment '专区';
  133. alter table linkstore
  134. add tips varchar(255) null comment '介绍';
  135. alter table linkstore
  136. add domain varchar(255) null;
  137. alter table linkstore
  138. add app int default 0 null comment '是否app';
  139. alter table linkstore
  140. add install_num int default 0 null comment '安装量';
  141. alter table linkstore
  142. add bgColor varchar(30) null comment '背景颜色';
  143. alter table linkstore
  144. add vip int default 0 null comment '是否会员可见 0所有人 1=会员';
  145. alter table linkstore
  146. add custom text null comment '自定义配置';
  147. alter table linkstore
  148. add user_id int null comment '用户id';
  149. alter table linkstore
  150. add status int default 1 null comment '状态 1=展示 0=待审核';
  151. alter table linkstore
  152. add group_ids varchar(200) default '0' null comment '可见用户分组';
  153. #创建note数据表
  154. create table if not exists note
  155. (
  156. id bigint auto_increment
  157. primary key,
  158. constraint note_id_uindex
  159. unique (id)
  160. ) character set utf8mb4
  161. collate utf8mb4_general_ci;
  162. alter table note
  163. add user_id bigint null;
  164. alter table note
  165. add title varchar(50) null;
  166. alter table note
  167. add text text null;
  168. alter table note
  169. add create_time datetime null;
  170. alter table note
  171. add update_time datetime null;
  172. alter table note
  173. add weight int default 0 null;
  174. create index note_user_id_index
  175. on note (user_id);
  176. #创建search_engine数据表
  177. create table if not exists search_engine
  178. (
  179. id int auto_increment
  180. primary key
  181. ) character set utf8mb4
  182. collate utf8mb4_general_ci comment '搜索引擎';
  183. alter table search_engine
  184. add name varchar(50) null comment '名称';
  185. alter table search_engine
  186. add icon varchar(255) null comment '图标 128x128';
  187. alter table search_engine
  188. add url varchar(255) null comment '跳转url';
  189. alter table search_engine
  190. add sort int default 0 null comment '排序';
  191. alter table search_engine
  192. add create_time datetime null comment '添加时间';
  193. alter table search_engine
  194. add status int default 0 null comment '状态 0=关闭 1=启用';
  195. alter table search_engine
  196. add tips varchar(250) null comment '搜索引擎介绍';
  197. #创建setting表
  198. create table if not exists setting
  199. (
  200. `keys` varchar(200) not null
  201. primary key
  202. ) character set utf8mb4
  203. collate utf8mb4_general_ci;
  204. alter table setting
  205. add value text null;
  206. #创建tabbar数据表
  207. create table if not exists tabbar
  208. (
  209. user_id int null
  210. ) character set utf8mb4
  211. collate utf8mb4_general_ci comment '用户页脚信息';
  212. alter table tabbar
  213. add tabs longtext null;
  214. alter table tabbar
  215. add update_time datetime null;
  216. #创建token表
  217. create table if not exists token
  218. (
  219. id bigint auto_increment
  220. primary key,
  221. constraint token_id_uindex
  222. unique (id)
  223. ) character set utf8mb4
  224. collate utf8mb4_general_ci;
  225. alter table token
  226. add user_id int null;
  227. alter table token
  228. add token tinytext null;
  229. alter table token
  230. add create_time int null;
  231. alter table token
  232. add ip tinytext null;
  233. alter table token
  234. add user_agent tinytext null;
  235. alter table token
  236. add access_token varchar(200) null comment 'qq的令牌';
  237. #创建user表
  238. create table if not exists user
  239. (
  240. id int auto_increment
  241. primary key,
  242. constraint user_id_uindex
  243. unique (id)
  244. ) character set utf8mb4
  245. collate utf8mb4_general_ci;
  246. alter table user
  247. add avatar varchar(255) null comment '头像';
  248. alter table user
  249. add mail varchar(50) null;
  250. alter table user
  251. add password tinytext null;
  252. alter table user
  253. add create_time datetime null;
  254. alter table user
  255. add login_ip varchar(100) null comment '登录IP';
  256. alter table user
  257. add register_ip varchar(100) null comment '注册IP';
  258. alter table user
  259. add manager int default 0 null;
  260. alter table user
  261. add login_fail_count int default 0 null;
  262. alter table user
  263. add login_time datetime null comment '登录时间';
  264. alter table user
  265. add qq_open_id varchar(200) null comment 'qq开放平台Id';
  266. alter table user
  267. add nickname varchar(200) null comment '昵称';
  268. alter table user
  269. add status int default 0 null comment '用户账号状态 0正常 1冻结';
  270. alter table user
  271. add active date null comment '今日是否活跃';
  272. alter table user
  273. add group_id bigint default 0 null;
  274. alter table user
  275. add constraint user_pk
  276. unique (mail);
  277. alter table user
  278. add constraint user_pk_2
  279. unique (qq_open_id);
  280. #创建user_search_engine表
  281. create table if not exists user_search_engine
  282. (
  283. user_id int not null
  284. primary key,
  285. constraint user_search_engine_pk
  286. unique (user_id)
  287. ) character set utf8mb4
  288. collate utf8mb4_general_ci comment '用户搜索引擎同步表';
  289. alter table user_search_engine
  290. add list longtext null;
  291. #创建wallpaper表
  292. create table if not exists wallpaper
  293. (
  294. id int auto_increment
  295. primary key
  296. ) character set utf8mb4
  297. collate utf8mb4_general_ci;
  298. alter table wallpaper
  299. add type int null comment '1=folder;0=assets';
  300. alter table wallpaper
  301. add folder int null comment '0';
  302. alter table wallpaper
  303. add mime int default 0 null comment '文件类型0=images,1=video';
  304. alter table wallpaper
  305. add url text null comment '图片地址';
  306. alter table wallpaper
  307. add cover text null comment '封面';
  308. alter table wallpaper
  309. add create_time datetime null;
  310. alter table wallpaper
  311. add name varchar(200) null comment '标题';
  312. alter table wallpaper
  313. add sort int default 999 null;
  314. create table user_group
  315. (
  316. id bigint auto_increment comment '自增ID',
  317. constraint user_group_pk
  318. primary key (id)
  319. )
  320. comment '用户分组';
  321. alter table user_group
  322. add name varchar(50) not null comment '分组名称';
  323. alter table user_group
  324. add create_time datetime null comment '创建时间';
  325. alter table user_group
  326. add sort int default 0 null comment '排序';
  327. ##创建结束
  328. ##卡片组件安装部分
  329. # 创建待办内容数据表
  330. create table if not exists plugins_todo
  331. (
  332. id int auto_increment
  333. primary key
  334. ) comment '待办事项';
  335. alter table plugins_todo
  336. add status int default 0 null comment '状态1=完成,0=未完成';
  337. alter table plugins_todo
  338. add user_id int null;
  339. alter table plugins_todo
  340. add create_time datetime null;
  341. alter table plugins_todo
  342. add expire_time datetime null;
  343. alter table plugins_todo
  344. add todo text(1000) null;
  345. alter table plugins_todo
  346. add weight int null comment '重要程度 1-6 颜色划分';
  347. alter table plugins_todo
  348. add folder varchar(20) null comment 'today=今天;week=最近七天;其他正常';
  349. create index plugins_todo_user_id_index
  350. on plugins_todo (user_id);
  351. # 创建待办文件夹数据表
  352. create table if not exists plugins_todo_folder
  353. (
  354. id int auto_increment,
  355. primary key (id)
  356. ) comment 'todo分类';
  357. alter table plugins_todo_folder
  358. add column user_id int null comment '用户';
  359. alter table plugins_todo_folder
  360. add column name varchar(30) null;
  361. alter table plugins_todo_folder
  362. add column create_time datetime null;
  363. create index plugins_todo_folder_user_id_index
  364. on plugins_todo_folder (user_id);
  365. INSERT INTO card (name, name_en, version, tips, src, url, `window`)
  366. VALUES ('今天吃什么', 'food', 3, '吃什么是个很麻烦的事情', '/plugins/food/static/ico.png', '/plugins/food/card', '/plugins/food/window')
  367. ON DUPLICATE KEY UPDATE name = VALUES(name), version = VALUES(version), tips = VALUES(tips), src = VALUES(src), url = VALUES(url), `window` = VALUES(`window`);
  368. INSERT INTO card (name, name_en, version, tips, src, url, `window`)
  369. VALUES ('天气', 'weather', 13, '获取您所在地的实时天气!', '/plugins/weather/static/ico.png', '/plugins/weather/card', '/plugins/weather/window')
  370. ON DUPLICATE KEY UPDATE name = VALUES(name), version = VALUES(version), tips = VALUES(tips), src = VALUES(src), url = VALUES(url), `window` = VALUES(`window`);
  371. INSERT INTO card (name, name_en, version, tips, src, url, `window`)
  372. VALUES ('电子木鱼', 'muyu', 5, '木鱼一敲 烦恼丢掉', '/plugins/muyu/static/ico.png', '/plugins/muyu/card', '/plugins/muyu/window')
  373. ON DUPLICATE KEY UPDATE name = VALUES(name), version = VALUES(version), tips = VALUES(tips), src = VALUES(src), url = VALUES(url), `window` = VALUES(`window`);
  374. INSERT INTO card (name, name_en, version, tips, src, url, `window`)
  375. VALUES ('热搜', 'topSearch', 15, '聚合百度,哔站,微博,知乎,头条等热搜!', '/plugins/topSearch/static/ico.png', '/plugins/topSearch/card', '/plugins/topSearch/window')
  376. ON DUPLICATE KEY UPDATE name = VALUES(name), version = VALUES(version), tips = VALUES(tips), src = VALUES(src), url = VALUES(url), `window` = VALUES(`window`);
  377. INSERT INTO card (name, name_en, version, tips, src, url, `window`)
  378. VALUES ('记事本', 'noteApp', 15, '快捷记录您的灵感', '/plugins/noteApp/static/ico.png', '/plugins/noteApp/card', '/noteApp')
  379. ON DUPLICATE KEY UPDATE name = VALUES(name), version = VALUES(version), tips = VALUES(tips), src = VALUES(src), url = VALUES(url), `window` = VALUES(`window`);
  380. INSERT INTO card (name, name_en, version, tips, src, url, `window`)
  381. VALUES ('每日诗词', 'poetry', 8, '精选每日诗词!', '/plugins/poetry/static/ico.png', '/plugins/poetry/card', '/plugins/poetry/window')
  382. ON DUPLICATE KEY UPDATE name = VALUES(name), version = VALUES(version), tips = VALUES(tips), src = VALUES(src), url = VALUES(url), `window` = VALUES(`window`);
  383. INSERT INTO card (name, name_en, version, tips, src, url, `window`)
  384. VALUES ('日历', 'calendar', 1, '日历', '/plugins/calendar/static/ico.png', '/plugins/calendar/card', '/plugins/calendar/window')
  385. ON DUPLICATE KEY UPDATE name = VALUES(name), version = VALUES(version), tips = VALUES(tips), src = VALUES(src), url = VALUES(url), `window` = VALUES(`window`);
  386. INSERT INTO card (name, name_en, version, tips, src, url, `window`)
  387. VALUES ('待办事项', 'todo', 8, '快捷添加待办事项', '/plugins/todo/static/ico.png', '/plugins/todo/card', '/plugins/todo/window')
  388. ON DUPLICATE KEY UPDATE name = VALUES(name), version = VALUES(version), tips = VALUES(tips), src = VALUES(src), url = VALUES(url), `window` = VALUES(`window`);