install.sql 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  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. alter table note
  175. add sort int default 0 null;
  176. create index note_user_id_index
  177. on note (user_id);
  178. #创建search_engine数据表
  179. create table if not exists search_engine
  180. (
  181. id int auto_increment
  182. primary key
  183. ) character set utf8mb4
  184. collate utf8mb4_general_ci comment '搜索引擎';
  185. alter table search_engine
  186. add name varchar(50) null comment '名称';
  187. alter table search_engine
  188. add icon varchar(255) null comment '图标 128x128';
  189. alter table search_engine
  190. add url varchar(255) null comment '跳转url';
  191. alter table search_engine
  192. add sort int default 0 null comment '排序';
  193. alter table search_engine
  194. add create_time datetime null comment '添加时间';
  195. alter table search_engine
  196. add status int default 0 null comment '状态 0=关闭 1=启用';
  197. alter table search_engine
  198. add tips varchar(250) null comment '搜索引擎介绍';
  199. #创建setting表
  200. create table if not exists setting
  201. (
  202. `keys` varchar(200) not null
  203. primary key
  204. ) character set utf8mb4
  205. collate utf8mb4_general_ci;
  206. alter table setting
  207. add value text null;
  208. #创建tabbar数据表
  209. create table if not exists tabbar
  210. (
  211. user_id int null
  212. ) character set utf8mb4
  213. collate utf8mb4_general_ci comment '用户页脚信息';
  214. alter table tabbar
  215. add tabs longtext null;
  216. alter table tabbar
  217. add update_time datetime null;
  218. #创建token表
  219. create table if not exists token
  220. (
  221. id bigint auto_increment
  222. primary key,
  223. constraint token_id_uindex
  224. unique (id)
  225. ) character set utf8mb4
  226. collate utf8mb4_general_ci;
  227. alter table token
  228. add user_id int null;
  229. alter table token
  230. add token tinytext null;
  231. alter table token
  232. add create_time int null;
  233. alter table token
  234. add ip tinytext null;
  235. alter table token
  236. add user_agent tinytext null;
  237. alter table token
  238. add access_token varchar(200) null comment 'qq的令牌';
  239. #创建user表
  240. create table if not exists user
  241. (
  242. id int auto_increment
  243. primary key,
  244. constraint user_id_uindex
  245. unique (id)
  246. ) character set utf8mb4
  247. collate utf8mb4_general_ci;
  248. alter table user
  249. add avatar varchar(255) null comment '头像';
  250. alter table user
  251. add mail varchar(50) null;
  252. alter table user
  253. add password tinytext null;
  254. alter table user
  255. add create_time datetime null;
  256. alter table user
  257. add login_ip varchar(100) null comment '登录IP';
  258. alter table user
  259. add register_ip varchar(100) null comment '注册IP';
  260. alter table user
  261. add manager int default 0 null;
  262. alter table user
  263. add login_fail_count int default 0 null;
  264. alter table user
  265. add login_time datetime null comment '登录时间';
  266. alter table user
  267. add qq_open_id varchar(200) null comment 'qq开放平台Id';
  268. alter table user
  269. add nickname varchar(200) null comment '昵称';
  270. alter table user
  271. add status int default 0 null comment '用户账号状态 0正常 1冻结';
  272. alter table user
  273. add active date null comment '今日是否活跃';
  274. alter table user
  275. add group_id bigint default 0 null;
  276. alter table user
  277. add constraint user_pk
  278. unique (mail);
  279. alter table user
  280. add constraint user_pk_2
  281. unique (qq_open_id);
  282. #创建user_search_engine表
  283. create table if not exists user_search_engine
  284. (
  285. user_id int not null
  286. primary key,
  287. constraint user_search_engine_pk
  288. unique (user_id)
  289. ) character set utf8mb4
  290. collate utf8mb4_general_ci comment '用户搜索引擎同步表';
  291. alter table user_search_engine
  292. add list longtext null;
  293. #创建wallpaper表
  294. create table if not exists wallpaper
  295. (
  296. id int auto_increment
  297. primary key
  298. ) character set utf8mb4
  299. collate utf8mb4_general_ci;
  300. alter table wallpaper
  301. add type int null comment '1=folder;0=assets';
  302. alter table wallpaper
  303. add folder int null comment '0';
  304. alter table wallpaper
  305. add mime int default 0 null comment '文件类型0=images,1=video';
  306. alter table wallpaper
  307. add url text null comment '图片地址';
  308. alter table wallpaper
  309. add cover text null comment '封面';
  310. alter table wallpaper
  311. add create_time datetime null;
  312. alter table wallpaper
  313. add name varchar(200) null comment '标题';
  314. alter table wallpaper
  315. add sort int default 999 null;
  316. create table user_group
  317. (
  318. id bigint auto_increment comment '自增ID',
  319. constraint user_group_pk
  320. primary key (id)
  321. )
  322. comment '用户分组';
  323. alter table user_group
  324. add name varchar(50) not null comment '分组名称';
  325. alter table user_group
  326. add create_time datetime null comment '创建时间';
  327. alter table user_group
  328. add sort int default 0 null comment '排序';
  329. ##创建结束
  330. ##卡片组件安装部分
  331. # 创建待办内容数据表
  332. create table if not exists plugins_todo
  333. (
  334. id int auto_increment
  335. primary key
  336. ) comment '待办事项';
  337. alter table plugins_todo
  338. add status int default 0 null comment '状态1=完成,0=未完成';
  339. alter table plugins_todo
  340. add user_id int null;
  341. alter table plugins_todo
  342. add create_time datetime null;
  343. alter table plugins_todo
  344. add expire_time datetime null;
  345. alter table plugins_todo
  346. add todo text(1000) null;
  347. alter table plugins_todo
  348. add weight int null comment '重要程度 1-6 颜色划分';
  349. alter table plugins_todo
  350. add folder varchar(20) null comment 'today=今天;week=最近七天;其他正常';
  351. create index plugins_todo_user_id_index
  352. on plugins_todo (user_id);
  353. # 创建待办文件夹数据表
  354. create table if not exists plugins_todo_folder
  355. (
  356. id int auto_increment,
  357. primary key (id)
  358. ) comment 'todo分类';
  359. alter table plugins_todo_folder
  360. add column user_id int null comment '用户';
  361. alter table plugins_todo_folder
  362. add column name varchar(30) null;
  363. alter table plugins_todo_folder
  364. add column create_time datetime null;
  365. create index plugins_todo_folder_user_id_index
  366. on plugins_todo_folder (user_id);
  367. INSERT INTO card (name, name_en, version, tips, src, url, `window`)
  368. VALUES ('今天吃什么', 'food', 3, '吃什么是个很麻烦的事情', '/plugins/food/static/ico.png', '/plugins/food/card', '/plugins/food/window')
  369. ON DUPLICATE KEY UPDATE name = VALUES(name), version = VALUES(version), tips = VALUES(tips), src = VALUES(src), url = VALUES(url), `window` = VALUES(`window`);
  370. INSERT INTO card (name, name_en, version, tips, src, url, `window`)
  371. VALUES ('天气', 'weather', 13, '获取您所在地的实时天气!', '/plugins/weather/static/ico.png', '/plugins/weather/card', '/plugins/weather/window')
  372. ON DUPLICATE KEY UPDATE name = VALUES(name), version = VALUES(version), tips = VALUES(tips), src = VALUES(src), url = VALUES(url), `window` = VALUES(`window`);
  373. INSERT INTO card (name, name_en, version, tips, src, url, `window`)
  374. VALUES ('电子木鱼', 'muyu', 5, '木鱼一敲 烦恼丢掉', '/plugins/muyu/static/ico.png', '/plugins/muyu/card', '/plugins/muyu/window')
  375. ON DUPLICATE KEY UPDATE name = VALUES(name), version = VALUES(version), tips = VALUES(tips), src = VALUES(src), url = VALUES(url), `window` = VALUES(`window`);
  376. INSERT INTO card (name, name_en, version, tips, src, url, `window`)
  377. VALUES ('热搜', 'topSearch', 15, '聚合百度,哔站,微博,知乎,头条等热搜!', '/plugins/topSearch/static/ico.png', '/plugins/topSearch/card', '/plugins/topSearch/window')
  378. ON DUPLICATE KEY UPDATE name = VALUES(name), version = VALUES(version), tips = VALUES(tips), src = VALUES(src), url = VALUES(url), `window` = VALUES(`window`);
  379. INSERT INTO card (name, name_en, version, tips, src, url, `window`)
  380. VALUES ('记事本', 'noteApp', 15, '快捷记录您的灵感', '/plugins/noteApp/static/ico.png', '/plugins/noteApp/card', '/noteApp')
  381. ON DUPLICATE KEY UPDATE name = VALUES(name), version = VALUES(version), tips = VALUES(tips), src = VALUES(src), url = VALUES(url), `window` = VALUES(`window`);
  382. INSERT INTO card (name, name_en, version, tips, src, url, `window`)
  383. VALUES ('每日诗词', 'poetry', 8, '精选每日诗词!', '/plugins/poetry/static/ico.png', '/plugins/poetry/card', '/plugins/poetry/window')
  384. ON DUPLICATE KEY UPDATE name = VALUES(name), version = VALUES(version), tips = VALUES(tips), src = VALUES(src), url = VALUES(url), `window` = VALUES(`window`);
  385. INSERT INTO card (name, name_en, version, tips, src, url, `window`)
  386. VALUES ('日历', 'calendar', 1, '日历', '/plugins/calendar/static/ico.png', '/plugins/calendar/card', '/plugins/calendar/window')
  387. ON DUPLICATE KEY UPDATE name = VALUES(name), version = VALUES(version), tips = VALUES(tips), src = VALUES(src), url = VALUES(url), `window` = VALUES(`window`);
  388. INSERT INTO card (name, name_en, version, tips, src, url, `window`)
  389. VALUES ('待办事项', 'todo', 8, '快捷添加待办事项', '/plugins/todo/static/ico.png', '/plugins/todo/card', '/plugins/todo/window')
  390. ON DUPLICATE KEY UPDATE name = VALUES(name), version = VALUES(version), tips = VALUES(tips), src = VALUES(src), url = VALUES(url), `window` = VALUES(`window`);
  391. INSERT INTO card (name, name_en, version, tips, src, url, `window`)
  392. VALUES ('倒计时', 'countdown', 8, '个性化自定义事件的倒计时组件', '/plugins/countdown/static/ico.png', '/plugins/countdown/card', '/plugins/countdown/window')
  393. ON DUPLICATE KEY UPDATE name = VALUES(name), version = VALUES(version), tips = VALUES(tips), src = VALUES(src), url = VALUES(url), `window` = VALUES(`window`);
  394. INSERT INTO card (name, name_en, version, tips, src, url, `window`)
  395. VALUES ('纪念日', 'commemorate', 8, '个性化自定义事件的纪念日组件', '/plugins/commemorate/static/ico.png', '/plugins/commemorate/card', '/plugins/commemorate/window')
  396. ON DUPLICATE KEY UPDATE name = VALUES(name), version = VALUES(version), tips = VALUES(tips), src = VALUES(src), url = VALUES(url), `window` = VALUES(`window`);