initDB.sql 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773
  1. -- --------------------------------------------------------
  2. -- Server version: 10.5.5-MariaDB - MariaDB Server
  3. -- Server OS: Linux
  4. -- --------------------------------------------------------
  5. /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  6. /*!40101 SET NAMES utf8 */;
  7. /*!50503 SET NAMES utf8mb4 */;
  8. /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
  9. /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
  10. -- Dumping database structure for myanimebot
  11. CREATE DATABASE IF NOT EXISTS `myanimebot` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
  12. USE `myanimebot`;
  13. -- Dumping structure for view myanimebot.check_DuplicateFeeds
  14. -- Creating temporary table to overcome VIEW dependency errors
  15. CREATE TABLE `check_DuplicateFeeds` (
  16. `published` DATETIME NOT NULL,
  17. `title` MEDIUMTEXT NULL COLLATE 'utf8mb4_general_ci',
  18. `user` TINYTEXT NULL COLLATE 'utf8mb4_general_ci',
  19. `total` BIGINT(21) NOT NULL
  20. ) ENGINE=MyISAM;
  21. -- Dumping structure for view myanimebot.check_DuplicateMedia
  22. -- Creating temporary table to overcome VIEW dependency errors
  23. CREATE TABLE `check_DuplicateMedia` (
  24. `guid` MEDIUMTEXT NOT NULL COLLATE 'utf8mb4_general_ci',
  25. `title` MEDIUMTEXT NULL COLLATE 'utf8mb4_general_ci',
  26. `total` BIGINT(21) NOT NULL
  27. ) ENGINE=MyISAM;
  28. -- Dumping structure for view myanimebot.check_EmptyThumbnail
  29. -- Creating temporary table to overcome VIEW dependency errors
  30. CREATE TABLE `check_EmptyThumbnail` (
  31. `id` INT(11) UNSIGNED NOT NULL,
  32. `guid` MEDIUMTEXT NOT NULL COLLATE 'utf8mb4_general_ci',
  33. `title` MEDIUMTEXT NULL COLLATE 'utf8mb4_general_ci',
  34. `thumbnail` MEDIUMTEXT NULL COLLATE 'utf8mb4_general_ci'
  35. ) ENGINE=MyISAM;
  36. -- Dumping structure for view myanimebot.check_EventExecution
  37. -- Creating temporary table to overcome VIEW dependency errors
  38. CREATE TABLE `check_EventExecution` (
  39. `table` VARCHAR(64) NOT NULL COLLATE 'utf8_general_ci',
  40. `refreshed` DATETIME NULL
  41. ) ENGINE=MyISAM;
  42. -- Dumping structure for view myanimebot.check_Index
  43. -- Creating temporary table to overcome VIEW dependency errors
  44. CREATE TABLE `check_Index` (
  45. `table` VARCHAR(192) NOT NULL COLLATE 'utf8_general_ci',
  46. `index` VARCHAR(192) NOT NULL COLLATE 'utf8_general_ci',
  47. `read` BIGINT(21) NOT NULL
  48. ) ENGINE=MyISAM;
  49. -- Dumping structure for view myanimebot.check_OrphanMedias
  50. -- Creating temporary table to overcome VIEW dependency errors
  51. CREATE TABLE `check_OrphanMedias` (
  52. `id` INT(11) UNSIGNED NOT NULL,
  53. `media` MEDIUMTEXT NULL COLLATE 'utf8mb4_general_ci'
  54. ) ENGINE=MyISAM;
  55. -- Dumping structure for view myanimebot.check_TablesDiskUsage
  56. -- Creating temporary table to overcome VIEW dependency errors
  57. CREATE TABLE `check_TablesDiskUsage` (
  58. `table` VARCHAR(64) NOT NULL COLLATE 'utf8_general_ci',
  59. `dataMB` DECIMAL(24,2) NULL,
  60. `indexMB` DECIMAL(24,2) NULL,
  61. `totalMB` DECIMAL(25,2) NULL,
  62. `total` BIGINT(22) UNSIGNED NULL
  63. ) ENGINE=MyISAM;
  64. -- Dumping structure for event myanimebot.event_generate_DailyAveragePerUser
  65. DELIMITER //
  66. CREATE EVENT `event_generate_DailyAveragePerUser` ON SCHEDULE EVERY 1 DAY STARTS '2020-01-05 01:30:00' ON COMPLETION PRESERVE ENABLE DO BEGIN
  67. # Create job_DailyAveragePerUser
  68. # We drop the curent table
  69. DROP TABLE IF EXISTS job_DailyAveragePerUser;
  70. # We recreate the table with the current result of the view
  71. CREATE TABLE job_DailyAveragePerUser IGNORE AS
  72. SELECT user, AVG(count) AS 'average'
  73. FROM (
  74. SELECT user, DATE(published) AS 'date', COUNT(*) AS 'count'
  75. FROM t_feeds
  76. WHERE DATE(published) != DATE(NOW())
  77. GROUP BY user, DATE
  78. ) AS temp_DailyAveragePerUser
  79. GROUP BY user
  80. ORDER BY average DESC
  81. ;
  82. # We apply the right configuration for the new table
  83. ALTER TABLE job_DailyAveragePerUser
  84. COMMENT="Autogenerated - Average daily medias per user"
  85. COLLATE='utf8mb4_general_ci'
  86. ENGINE=InnoDB
  87. ;
  88. # We create an ID column for the table
  89. ALTER TABLE job_DailyAveragePerUser
  90. ADD COLUMN `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
  91. ADD PRIMARY KEY (`id`)
  92. ;
  93. # We create indexes for the table
  94. CREATE INDEX idx_user ON job_DailyAveragePerUser(user);
  95. # And we analyze the created table
  96. ANALYZE TABLE job_DailyAveragePerUser;
  97. END//
  98. DELIMITER ;
  99. -- Dumping structure for event myanimebot.event_generate_TopAnimes
  100. DELIMITER //
  101. CREATE EVENT `event_generate_TopAnimes` ON SCHEDULE EVERY 1 DAY STARTS '2019-12-08 05:00:00' ON COMPLETION PRESERVE ENABLE DO BEGIN
  102. # Create job_TopAnimes
  103. # We drop the curent table
  104. DROP TABLE IF EXISTS job_TopAnimes;
  105. # We recreate the table with the current result of the view
  106. CREATE TABLE job_TopAnimes AS SELECT * FROM v_TopAnimes;
  107. # We apply the right configuration for the new table
  108. ALTER TABLE job_TopAnimes
  109. COMMENT="Autogenerated - Top listed animes and number of users"
  110. COLLATE='utf8mb4_general_ci'
  111. ENGINE=InnoDB
  112. ;
  113. # We create an ID column for the table
  114. ALTER TABLE job_TopAnimes
  115. ADD COLUMN `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
  116. ADD PRIMARY KEY (`id`)
  117. ;
  118. # We create indexes for the table
  119. CREATE INDEX idx_anime ON job_TopAnimes(anime);
  120. # And we analyze the created table
  121. ANALYZE TABLE job_TopAnimes;
  122. END//
  123. DELIMITER ;
  124. -- Dumping structure for event myanimebot.event_generate_TopUniqueAnimePerUsers
  125. DELIMITER //
  126. CREATE EVENT `event_generate_TopUniqueAnimePerUsers` ON SCHEDULE EVERY 1 DAY STARTS '2019-11-05 05:00:00' ON COMPLETION PRESERVE ENABLE COMMENT 'Daily job' DO BEGIN
  127. # Create job_TopUniqueAnimePerUsers
  128. # We drop the curent table
  129. DROP TABLE IF EXISTS job_TopUniqueAnimePerUsers;
  130. # We recreate the table with the current result of the view
  131. CREATE TABLE job_TopUniqueAnimePerUsers AS SELECT * FROM v_TopUniqueAnimePerUsers;
  132. # We apply the right configuration for the new table
  133. ALTER TABLE job_TopUniqueAnimePerUsers
  134. COMMENT="Autogenerated - Unique Anime feeds per users"
  135. COLLATE='utf8mb4_general_ci'
  136. ENGINE=InnoDB
  137. ;
  138. # We create an ID column for the table
  139. ALTER TABLE job_TopUniqueAnimePerUsers
  140. ADD COLUMN `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
  141. ADD PRIMARY KEY (`id`)
  142. ;
  143. # We create indexes for the table
  144. CREATE INDEX idx_user ON job_TopUniqueAnimePerUsers(user);
  145. CREATE INDEX idx_title ON job_TopUniqueAnimePerUsers(title);
  146. # And we analyze the created table
  147. ANALYZE TABLE job_TopUniqueAnimePerUsers;
  148. END//
  149. DELIMITER ;
  150. -- Dumping structure for event myanimebot.event_generate_TotalDifferentAnimesPerUser
  151. DELIMITER //
  152. CREATE EVENT `event_generate_TotalDifferentAnimesPerUser` ON SCHEDULE EVERY 1 HOUR STARTS '2019-11-05 03:00:00' ON COMPLETION PRESERVE ENABLE COMMENT 'Daily job' DO BEGIN
  153. # Create job_TotalDifferentAnimesPerUser
  154. # We drop the curent table
  155. DROP TABLE IF EXISTS job_TotalDifferentAnimesPerUser;
  156. # We recreate the table with the current result of the view
  157. CREATE TABLE job_TotalDifferentAnimesPerUser AS SELECT * FROM v_TotalDifferentAnimesPerUser;
  158. # We apply the right configuration for the new table
  159. ALTER TABLE job_TotalDifferentAnimesPerUser
  160. COMMENT="Autogenerated - Total of different media per users"
  161. COLLATE='utf8mb4_general_ci'
  162. ENGINE=InnoDB
  163. ;
  164. # We create an ID column for the table
  165. ALTER TABLE job_TotalDifferentAnimesPerUser
  166. ADD COLUMN `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
  167. ADD PRIMARY KEY (`id`)
  168. ;
  169. # We create indexes for the table
  170. CREATE INDEX idx_user ON job_TotalDifferentAnimesPerUser(user);
  171. # And we analyze the created table
  172. ANALYZE TABLE job_TotalDifferentAnimesPerUser;
  173. END//
  174. DELIMITER ;
  175. -- Dumping structure for event myanimebot.event_history
  176. DELIMITER //
  177. CREATE EVENT `event_history` ON SCHEDULE EVERY 10 MINUTE STARTS '2019-11-15 00:00:00' ON COMPLETION PRESERVE ENABLE COMMENT 'Update the history table every 10 minutes' DO BEGIN
  178. # Initialization of my time variable
  179. SET @date = NOW();
  180. # We get the values that we want to store
  181. SELECT @totalFeeds := total FROM v_TotalFeeds;
  182. SELECT @totalUniqueFeeds := COUNT(0) FROM job_TopUniqueAnimePerUsers;
  183. SELECT @totalMedia := total FROM v_TotalAnimes;
  184. SELECT @totalUsers := COUNT(0) FROM t_users;
  185. SELECT @totalServers := COUNT(0) FROM t_servers;
  186. SELECT @totalDuplicateFeeds := COUNT(0) FROM check_DuplicateFeeds;
  187. SELECT @totalDuplicateMedia := COUNT(0) FROM check_DuplicateMedia;
  188. SELECT @totalEmptyThumbnail := COUNT(0) FROM check_EmptyThumbnail;
  189. SELECT @totalInactiveUsers := COUNT(0) FROM v_ActiveUsers WHERE active = '0';
  190. SELECT @spaceFeedsTable := total FROM check_TablesDiskUsage WHERE check_TablesDiskUsage.table = "t_feeds";
  191. SELECT @spaceAnimesTable := total FROM check_TablesDiskUsage WHERE check_TablesDiskUsage.table = "t_animes";
  192. SELECT @spaceUsersTable := total FROM check_TablesDiskUsage WHERE check_TablesDiskUsage.table = "t_users";
  193. SELECT @spaceServersTable := total FROM check_TablesDiskUsage WHERE check_TablesDiskUsage.table = "t_servers";
  194. SELECT @dailyAveragePerUser := ROUND(AVG(average), 3) FROM job_DailyAveragePerUser;
  195. SELECT @totalOrphanMedias := COUNT(0) FROM check_OrphanMedias;
  196. SELECT @nbMediaManga := total FROM v_CountMediaType WHERE v_CountMediaType.media = "manga";
  197. SELECT @nbMediaAnime := total FROM v_CountMediaType WHERE v_CountMediaType.media = "anime";
  198. SELECT @nbLog := COUNT(0) FROM t_logs;
  199. SELECT @nbErrorLog := COUNT(0) FROM t_logs WHERE LEVEL >= 30;
  200. # We insert tour values
  201. INSERT INTO t_history (date, nbFeeds, nbUniqueFeeds, nbMedia, nbUsers, nbServers, nbDuplicateFeeds, nbDuplicateMedia, nbEmptyThumbnail, nbInactiveUsers, spaceFeedsTable, spaceAnimesTable, spaceUsersTable, spaceServersTable, dailyAveragePerUser, orphanMedias, nbMediaManga, nbMediaAnime, nbLog, nbErrorLog)
  202. VALUES (@date, @totalFeeds, @totalUniqueFeeds, @totalMedia, @totalUsers, @totalServers, @totalDuplicateFeeds, @totalDuplicateMedia, @totalEmptyThumbnail, @totalInactiveUsers, @spaceFeedsTable, @spaceAnimesTable, @spaceServersTable, @spaceServersTable, @dailyAveragePerUser, @totalOrphanMedias, @nbMediaManga, @nbMediaAnime, @nbLog, @nbErrorLog);
  203. END//
  204. DELIMITER ;
  205. -- Dumping structure for event myanimebot.event_maintenance
  206. DELIMITER //
  207. CREATE EVENT `event_maintenance` ON SCHEDULE EVERY 1 DAY STARTS '2019-11-17 06:00:00' ON COMPLETION PRESERVE ENABLE COMMENT 'Executed at 6am, analyze the SQL tables' DO BEGIN
  208. # Using the stored procedure.
  209. CALL myanimebot.sp_Maintenance();
  210. END//
  211. DELIMITER ;
  212. -- Dumping structure for table myanimebot.job_DailyAveragePerUser
  213. CREATE TABLE IF NOT EXISTS `job_DailyAveragePerUser` (
  214. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  215. `user` tinytext DEFAULT NULL,
  216. `average` decimal(24,4) DEFAULT NULL,
  217. PRIMARY KEY (`id`),
  218. KEY `idx_user` (`user`(255))
  219. ) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8mb4 COMMENT='Autogenerated - Average daily medias per user';
  220. -- Data exporting was unselected.
  221. -- Dumping structure for table myanimebot.job_TopAnimes
  222. CREATE TABLE IF NOT EXISTS `job_TopAnimes` (
  223. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  224. `anime` mediumtext DEFAULT NULL,
  225. `nbUser` bigint(21) NOT NULL DEFAULT 0,
  226. `total` bigint(21) NOT NULL DEFAULT 0,
  227. PRIMARY KEY (`id`),
  228. KEY `idx_anime` (`anime`(768))
  229. ) ENGINE=InnoDB AUTO_INCREMENT=3237 DEFAULT CHARSET=utf8mb4 COMMENT='Autogenerated - Top listed animes and number of users';
  230. -- Data exporting was unselected.
  231. -- Dumping structure for table myanimebot.job_TopUniqueAnimePerUsers
  232. CREATE TABLE IF NOT EXISTS `job_TopUniqueAnimePerUsers` (
  233. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  234. `user` tinytext DEFAULT NULL,
  235. `title` mediumtext DEFAULT NULL,
  236. `count` bigint(21) NOT NULL DEFAULT 0,
  237. PRIMARY KEY (`id`),
  238. KEY `idx_user` (`user`(255)),
  239. KEY `idx_title` (`title`(768))
  240. ) ENGINE=InnoDB AUTO_INCREMENT=4883 DEFAULT CHARSET=utf8mb4 COMMENT='Autogenerated - Unique Anime feeds per users';
  241. -- Data exporting was unselected.
  242. -- Dumping structure for table myanimebot.job_TotalDifferentAnimesPerUser
  243. CREATE TABLE IF NOT EXISTS `job_TotalDifferentAnimesPerUser` (
  244. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  245. `user` tinytext DEFAULT NULL,
  246. `total` bigint(21) NOT NULL DEFAULT 0,
  247. PRIMARY KEY (`id`),
  248. KEY `idx_user` (`user`(255))
  249. ) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8mb4 COMMENT='Autogenerated - Total of different media per users';
  250. -- Data exporting was unselected.
  251. -- Dumping structure for procedure myanimebot.sp_AnimeCountPerKeyword
  252. DELIMITER //
  253. CREATE PROCEDURE `sp_AnimeCountPerKeyword`(
  254. IN `anime_var` TINYTEXT,
  255. IN `limit_var` INT
  256. )
  257. SQL SECURITY INVOKER
  258. COMMENT 'Procédure pour récupèrer les statistiques d''animés répondant à un mot clef'
  259. BEGIN
  260. -- Default value is infinite for limit_var
  261. IF limit_var = ''
  262. THEN SET limit_var = '-1';
  263. END IF;
  264. -- Procedure to get animes statistics linked to a keyword
  265. SELECT title AS 'title', COUNT(0) AS 'total'
  266. FROM t_feeds
  267. WHERE MATCH(title) AGAINST (anime_var)
  268. GROUP BY title
  269. ORDER BY COUNT(id) DESC
  270. LIMIT limit_var
  271. ;
  272. END//
  273. DELIMITER ;
  274. -- Dumping structure for procedure myanimebot.sp_AnimesPerUser
  275. DELIMITER //
  276. CREATE PROCEDURE `sp_AnimesPerUser`(
  277. IN `user_var` TINYTEXT,
  278. IN `limit_var` INT
  279. )
  280. SQL SECURITY INVOKER
  281. COMMENT 'Procédure pour récupèrer les statistiques d''animés sur un utilisateur'
  282. BEGIN
  283. -- Default value is infinite for limit_var
  284. IF limit_var = ''
  285. THEN SET limit_var = '-1';
  286. END IF;
  287. -- Procedure to get the statistics of user's animes
  288. SELECT
  289. title AS "title",
  290. COUNT(title) AS "total"
  291. FROM t_feeds
  292. WHERE user = user_var
  293. GROUP BY title
  294. ORDER BY COUNT(title) DESC
  295. LIMIT limit_var
  296. ;
  297. END//
  298. DELIMITER ;
  299. -- Dumping structure for procedure myanimebot.sp_Maintenance
  300. DELIMITER //
  301. CREATE PROCEDURE `sp_Maintenance`()
  302. BEGIN
  303. # Analyzing database's tables.
  304. ANALYZE TABLE t_animes, t_feeds, t_history, t_servers, t_sys, t_users, t_logs, t_availability;
  305. END//
  306. DELIMITER ;
  307. -- Dumping structure for procedure myanimebot.sp_RenameUser
  308. DELIMITER //
  309. CREATE PROCEDURE `sp_RenameUser`(
  310. IN `old_name_var` TINYTEXT,
  311. IN `new_name_var` TINYTEXT
  312. )
  313. MODIFIES SQL DATA
  314. SQL SECURITY INVOKER
  315. COMMENT 'Rename a user in the database.'
  316. BEGIN
  317. -- Rename a user in the database.
  318. -- For the table t_users
  319. UPDATE t_users
  320. SET t_users.mal_user = new_name_var
  321. WHERE t_users.mal_user = old_name_var;
  322. -- For the table t_animes
  323. UPDATE t_animes
  324. SET t_animes.discoverer = new_name_var
  325. WHERE t_animes.discoverer = old_name_var;
  326. -- For the table t_feeds
  327. UPDATE t_feeds
  328. SET t_feeds.user = new_name_var
  329. WHERE t_feeds.user = old_name_var;
  330. END//
  331. DELIMITER ;
  332. -- Dumping structure for procedure myanimebot.sp_TotalForKeyword
  333. DELIMITER //
  334. CREATE PROCEDURE `sp_TotalForKeyword`(
  335. IN `anime_var` TINYTEXT
  336. )
  337. SQL SECURITY INVOKER
  338. COMMENT 'Total des animés répondants à un mot clef'
  339. BEGIN
  340. -- Total of animés that contains a specific keyword
  341. SELECT COUNT(0) AS 'total'
  342. FROM t_feeds
  343. WHERE MATCH(title) AGAINST (anime_var)
  344. ;
  345. END//
  346. DELIMITER ;
  347. -- Dumping structure for procedure myanimebot.sp_UsersPerKeyword
  348. DELIMITER //
  349. CREATE PROCEDURE `sp_UsersPerKeyword`(
  350. IN `anime_var` TINYTEXT,
  351. IN `limit_var` INT
  352. )
  353. READS SQL DATA
  354. SQL SECURITY INVOKER
  355. COMMENT 'Statistiques des utilisateurs par rapport à un mot clef'
  356. BEGIN
  357. -- Default value is infinite for limit_var
  358. IF limit_var = ''
  359. THEN SET limit_var = '-1';
  360. END IF;
  361. -- Statistics of users according to a specific keyword
  362. SELECT user AS 'user', COUNT(title) AS 'total'
  363. FROM t_feeds
  364. WHERE MATCH(title) AGAINST(anime_var)
  365. GROUP BY user
  366. ORDER BY COUNT(title) DESC
  367. LIMIT limit_var
  368. ;
  369. END//
  370. DELIMITER ;
  371. -- Dumping structure for table myanimebot.t_animes
  372. CREATE TABLE IF NOT EXISTS `t_animes` (
  373. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  374. `guid` mediumtext NOT NULL,
  375. `service` tinytext NOT NULL DEFAULT 'mal',
  376. `title` mediumtext DEFAULT NULL,
  377. `thumbnail` mediumtext DEFAULT NULL,
  378. `found` datetime NOT NULL DEFAULT current_timestamp(),
  379. `discoverer` tinytext DEFAULT 'Anonymous',
  380. `media` tinytext DEFAULT 'unknown',
  381. PRIMARY KEY (`id`),
  382. UNIQUE KEY `idx_guid` (`guid`(768)) USING BTREE,
  383. KEY `idx_title` (`title`(768)),
  384. KEY `idx_discoverer` (`discoverer`(255)),
  385. KEY `idx_media` (`media`(255)),
  386. FULLTEXT KEY `idx_title_str` (`title`)
  387. ) ENGINE=InnoDB AUTO_INCREMENT=3329 DEFAULT CHARSET=utf8mb4 AVG_ROW_LENGTH=224;
  388. -- Data exporting was unselected.
  389. -- Dumping structure for table myanimebot.t_availability
  390. CREATE TABLE IF NOT EXISTS `t_availability` (
  391. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  392. `date` datetime NOT NULL DEFAULT current_timestamp(),
  393. `service` tinytext CHARACTER SET latin1 NOT NULL DEFAULT 'mal',
  394. `code` smallint(6) NOT NULL DEFAULT 0,
  395. PRIMARY KEY (`id`),
  396. KEY `idx_date` (`date`),
  397. KEY `idx_service` (`service`(255))
  398. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  399. -- Data exporting was unselected.
  400. -- Dumping structure for table myanimebot.t_feeds
  401. CREATE TABLE IF NOT EXISTS `t_feeds` (
  402. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  403. `published` datetime NOT NULL,
  404. `title` mediumtext DEFAULT NULL,
  405. `service` tinytext NOT NULL DEFAULT 'mal',
  406. `url` mediumtext NOT NULL,
  407. `user` tinytext DEFAULT NULL,
  408. `found` datetime NOT NULL DEFAULT current_timestamp(),
  409. `type` tinytext DEFAULT 'N/A',
  410. PRIMARY KEY (`id`),
  411. KEY `idx_user` (`user`(255)),
  412. KEY `idx_title` (`title`(768)),
  413. KEY `idx_published` (`published`),
  414. KEY `idx_type` (`type`(255)),
  415. FULLTEXT KEY `idx_title_str` (`title`)
  416. ) ENGINE=InnoDB AUTO_INCREMENT=14769 DEFAULT CHARSET=utf8mb4 AVG_ROW_LENGTH=172;
  417. -- Data exporting was unselected.
  418. -- Dumping structure for table myanimebot.t_history
  419. CREATE TABLE IF NOT EXISTS `t_history` (
  420. `date` datetime NOT NULL,
  421. `nbFeeds` int(11) unsigned NOT NULL DEFAULT 0,
  422. `nbUniqueFeeds` int(11) unsigned NOT NULL DEFAULT 0,
  423. `nbMedia` int(11) unsigned NOT NULL DEFAULT 0,
  424. `nbUsers` int(11) unsigned NOT NULL DEFAULT 0,
  425. `nbServers` int(11) unsigned NOT NULL DEFAULT 0,
  426. `nbDuplicateFeeds` int(11) unsigned NOT NULL DEFAULT 0,
  427. `nbDuplicateMedia` int(11) unsigned NOT NULL DEFAULT 0,
  428. `nbEmptyThumbnail` int(11) unsigned NOT NULL DEFAULT 0,
  429. `nbInactiveUsers` int(11) unsigned NOT NULL DEFAULT 0,
  430. `spaceFeedsTable` int(11) unsigned NOT NULL DEFAULT 0,
  431. `spaceAnimesTable` int(11) unsigned NOT NULL DEFAULT 0,
  432. `spaceUsersTable` int(11) unsigned NOT NULL DEFAULT 0,
  433. `spaceServersTable` int(11) unsigned NOT NULL DEFAULT 0,
  434. `dailyAveragePerUser` float unsigned NOT NULL DEFAULT 0,
  435. `orphanMedias` int(11) unsigned NOT NULL DEFAULT 0,
  436. `nbMediaManga` int(11) unsigned NOT NULL DEFAULT 0,
  437. `nbMediaAnime` int(11) unsigned NOT NULL DEFAULT 0,
  438. `nbLog` int(11) NOT NULL DEFAULT 0,
  439. `nbErrorLog` int(11) NOT NULL DEFAULT 0,
  440. PRIMARY KEY (`date`) USING BTREE
  441. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='History of database';
  442. -- Data exporting was unselected.
  443. -- Dumping structure for table myanimebot.t_logs
  444. CREATE TABLE IF NOT EXISTS `t_logs` (
  445. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  446. `host` tinytext CHARACTER SET latin1 NOT NULL DEFAULT 'unspecified.host',
  447. `level` int(11) DEFAULT NULL,
  448. `type` mediumtext CHARACTER SET utf8 DEFAULT NULL,
  449. `log` text CHARACTER SET latin1 DEFAULT NULL,
  450. `date` datetime NOT NULL DEFAULT current_timestamp(),
  451. `source` tinytext CHARACTER SET latin1 NOT NULL DEFAULT 'unknown',
  452. PRIMARY KEY (`id`),
  453. KEY `idx_level` (`level`) USING BTREE,
  454. KEY `idx_date` (`date`) USING BTREE,
  455. KEY `idx_host` (`host`(255)),
  456. KEY `idx_by` (`source`(255)) USING BTREE,
  457. FULLTEXT KEY `idx_log` (`log`)
  458. ) ENGINE=InnoDB AUTO_INCREMENT=62280 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPRESSED;
  459. -- Data exporting was unselected.
  460. -- Dumping structure for table myanimebot.t_servers
  461. CREATE TABLE IF NOT EXISTS `t_servers` (
  462. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  463. `server` tinytext NOT NULL,
  464. `channel` tinytext DEFAULT NULL,
  465. `admin_group` tinytext DEFAULT NULL,
  466. PRIMARY KEY (`id`),
  467. UNIQUE KEY `idx_server` (`server`(255)) USING BTREE
  468. ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 AVG_ROW_LENGTH=5461;
  469. -- Data exporting was unselected.
  470. -- Dumping structure for table myanimebot.t_sys
  471. CREATE TABLE IF NOT EXISTS `t_sys` (
  472. `param` tinytext NOT NULL,
  473. `value` text DEFAULT NULL,
  474. PRIMARY KEY (`param`(100)) USING BTREE
  475. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  476. -- Data exporting was unselected.
  477. -- Dumping structure for table myanimebot.t_users
  478. CREATE TABLE IF NOT EXISTS `t_users` (
  479. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  480. `mal_user` tinytext NOT NULL,
  481. `service` tinytext NOT NULL DEFAULT 'mal',
  482. `servers` text DEFAULT NULL,
  483. `added` datetime NOT NULL DEFAULT current_timestamp(),
  484. PRIMARY KEY (`id`),
  485. UNIQUE KEY `idx_user` (`mal_user`(255)) USING BTREE,
  486. KEY `idx_servers` (`servers`(768)),
  487. KEY `idx_service` (`service`(255)),
  488. FULLTEXT KEY `idx_servers_str` (`servers`)
  489. ) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8mb4 AVG_ROW_LENGTH=1820 COMMENT='Table where are stored the users of this bot.';
  490. -- Data exporting was unselected.
  491. -- Dumping structure for view myanimebot.v_ActiveUsers
  492. -- Creating temporary table to overcome VIEW dependency errors
  493. CREATE TABLE `v_ActiveUsers` (
  494. `user` TINYTEXT NOT NULL COLLATE 'utf8mb4_general_ci',
  495. `active` VARCHAR(1) NOT NULL COLLATE 'utf8mb4_general_ci'
  496. ) ENGINE=MyISAM;
  497. -- Dumping structure for view myanimebot.v_CountFeedsType
  498. -- Creating temporary table to overcome VIEW dependency errors
  499. CREATE TABLE `v_CountFeedsType` (
  500. `type` TINYTEXT NULL COLLATE 'utf8mb4_general_ci',
  501. `total` BIGINT(21) NOT NULL
  502. ) ENGINE=MyISAM;
  503. -- Dumping structure for view myanimebot.v_CountMediaType
  504. -- Creating temporary table to overcome VIEW dependency errors
  505. CREATE TABLE `v_CountMediaType` (
  506. `media` TINYTEXT NULL COLLATE 'utf8mb4_general_ci',
  507. `total` BIGINT(21) NOT NULL
  508. ) ENGINE=MyISAM;
  509. -- Dumping structure for view myanimebot.v_DailyHistory
  510. -- Creating temporary table to overcome VIEW dependency errors
  511. CREATE TABLE `v_DailyHistory` (
  512. `date` DATE NULL,
  513. `nbFeeds` INT(11) UNSIGNED NULL,
  514. `nbUniqueFeeds` INT(11) UNSIGNED NULL,
  515. `nbMedia` INT(11) UNSIGNED NULL,
  516. `nbUsers` INT(11) UNSIGNED NULL,
  517. `nbServers` INT(11) UNSIGNED NULL,
  518. `nbDuplacteFeeds` DECIMAL(12,0) NULL,
  519. `nbDuplicateMedia` DECIMAL(12,0) NULL,
  520. `nbEmptyThumbnail` DECIMAL(12,0) NULL,
  521. `nbInactiveUsers` DECIMAL(12,0) NULL,
  522. `spaceFeedsTable` DECIMAL(12,0) NULL,
  523. `spaceAnimesTable` DECIMAL(12,0) NULL,
  524. `SpaceUsersTable` DECIMAL(12,0) NULL,
  525. `SpaceServersTable` DECIMAL(12,0) NULL,
  526. `dailyAveragePerUser` DOUBLE(17,0) NULL,
  527. `orphanMedias` DECIMAL(12,0) NULL,
  528. `nbMediaManga` DECIMAL(12,0) NULL,
  529. `nbMediaAnime` DECIMAL(12,0) NULL,
  530. `nbLog` DECIMAL(11,0) NULL,
  531. `nbErrorLog` DECIMAL(11,0) NULL
  532. ) ENGINE=MyISAM;
  533. -- Dumping structure for view myanimebot.v_Top
  534. -- Creating temporary table to overcome VIEW dependency errors
  535. CREATE TABLE `v_Top` (
  536. `user` TINYTEXT NULL COLLATE 'utf8mb4_general_ci',
  537. `total` BIGINT(21) NOT NULL
  538. ) ENGINE=MyISAM;
  539. -- Dumping structure for view myanimebot.v_TopAnimes
  540. -- Creating temporary table to overcome VIEW dependency errors
  541. CREATE TABLE `v_TopAnimes` (
  542. `anime` MEDIUMTEXT NULL COLLATE 'utf8mb4_general_ci',
  543. `nbUser` BIGINT(21) NOT NULL,
  544. `total` BIGINT(21) NOT NULL
  545. ) ENGINE=MyISAM;
  546. -- Dumping structure for view myanimebot.v_TopUniqueAnimePerUsers
  547. -- Creating temporary table to overcome VIEW dependency errors
  548. CREATE TABLE `v_TopUniqueAnimePerUsers` (
  549. `user` TINYTEXT NULL COLLATE 'utf8mb4_general_ci',
  550. `title` MEDIUMTEXT NULL COLLATE 'utf8mb4_general_ci',
  551. `count` BIGINT(21) NOT NULL
  552. ) ENGINE=MyISAM;
  553. -- Dumping structure for view myanimebot.v_TotalAnimes
  554. -- Creating temporary table to overcome VIEW dependency errors
  555. CREATE TABLE `v_TotalAnimes` (
  556. `total` BIGINT(21) NOT NULL
  557. ) ENGINE=MyISAM;
  558. -- Dumping structure for view myanimebot.v_TotalDifferentAnimesPerUser
  559. -- Creating temporary table to overcome VIEW dependency errors
  560. CREATE TABLE `v_TotalDifferentAnimesPerUser` (
  561. `user` TINYTEXT NULL COLLATE 'utf8mb4_general_ci',
  562. `total` BIGINT(21) NOT NULL
  563. ) ENGINE=MyISAM;
  564. -- Dumping structure for view myanimebot.v_TotalFeeds
  565. -- Creating temporary table to overcome VIEW dependency errors
  566. CREATE TABLE `v_TotalFeeds` (
  567. `total` BIGINT(21) NOT NULL
  568. ) ENGINE=MyISAM;
  569. -- Dumping structure for view myanimebot.check_DuplicateFeeds
  570. -- Removing temporary table and create final VIEW structure
  571. DROP TABLE IF EXISTS `check_DuplicateFeeds`;
  572. CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `check_DuplicateFeeds` AS select `t_feeds`.`published` AS `published`,`t_feeds`.`title` AS `title`,`t_feeds`.`user` AS `user`,count(0) AS `total` from `t_feeds` group by `t_feeds`.`published`,`t_feeds`.`title`,`t_feeds`.`user` having count(0) > 1;
  573. -- Dumping structure for view myanimebot.check_DuplicateMedia
  574. -- Removing temporary table and create final VIEW structure
  575. DROP TABLE IF EXISTS `check_DuplicateMedia`;
  576. CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `check_DuplicateMedia` AS select `t_animes`.`guid` AS `guid`,`t_animes`.`title` AS `title`,count(0) AS `total` from `t_animes` group by `t_animes`.`guid`,`t_animes`.`title` having count(0) > 1;
  577. -- Dumping structure for view myanimebot.check_EmptyThumbnail
  578. -- Removing temporary table and create final VIEW structure
  579. DROP TABLE IF EXISTS `check_EmptyThumbnail`;
  580. CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `check_EmptyThumbnail` AS select `t_animes`.`id` AS `id`,`t_animes`.`guid` AS `guid`,`t_animes`.`title` AS `title`,`t_animes`.`thumbnail` AS `thumbnail` from `t_animes` where `t_animes`.`thumbnail` = '' or `t_animes`.`thumbnail` is null;
  581. -- Dumping structure for view myanimebot.check_EventExecution
  582. -- Removing temporary table and create final VIEW structure
  583. DROP TABLE IF EXISTS `check_EventExecution`;
  584. CREATE ALGORITHM=MERGE SQL SECURITY DEFINER VIEW `check_EventExecution` AS select `information_schema`.`TABLES`.`TABLE_NAME` AS `table`,`information_schema`.`TABLES`.`CREATE_TIME` AS `refreshed` from `information_schema`.`TABLES` where `information_schema`.`TABLES`.`TABLE_NAME` like 'job\\_%' and `information_schema`.`TABLES`.`TABLE_SCHEMA` = 'myanimebot';
  585. -- Dumping structure for view myanimebot.check_Index
  586. -- Removing temporary table and create final VIEW structure
  587. DROP TABLE IF EXISTS `check_Index`;
  588. CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `check_Index` AS select `information_schema`.`INDEX_STATISTICS`.`TABLE_NAME` AS `table`,`information_schema`.`INDEX_STATISTICS`.`INDEX_NAME` AS `index`,`information_schema`.`INDEX_STATISTICS`.`ROWS_READ` AS `read` from `information_schema`.`INDEX_STATISTICS` where `information_schema`.`INDEX_STATISTICS`.`TABLE_SCHEMA` = 'myanimebot' and `information_schema`.`INDEX_STATISTICS`.`INDEX_NAME` <> 'PRIMARY' order by `information_schema`.`INDEX_STATISTICS`.`ROWS_READ` desc;
  589. -- Dumping structure for view myanimebot.check_OrphanMedias
  590. -- Removing temporary table and create final VIEW structure
  591. DROP TABLE IF EXISTS `check_OrphanMedias`;
  592. CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `check_OrphanMedias` AS select `t_animes`.`id` AS `id`,`t_animes`.`title` AS `media` from `t_animes` where !exists(select distinct `t_feeds`.`title` from `t_feeds` where `t_feeds`.`title` = `t_animes`.`title` limit 1);
  593. -- Dumping structure for view myanimebot.check_TablesDiskUsage
  594. -- Removing temporary table and create final VIEW structure
  595. DROP TABLE IF EXISTS `check_TablesDiskUsage`;
  596. CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `check_TablesDiskUsage` AS select `information_schema`.`TABLES`.`TABLE_NAME` AS `table`,round(`information_schema`.`TABLES`.`DATA_LENGTH` / 1024 / 1024,2) AS `dataMB`,round(`information_schema`.`TABLES`.`INDEX_LENGTH` / 1024 / 1024,2) AS `indexMB`,round((`information_schema`.`TABLES`.`DATA_LENGTH` + `information_schema`.`TABLES`.`INDEX_LENGTH`) / 1024 / 1024,2) AS `totalMB`,`information_schema`.`TABLES`.`DATA_LENGTH` + `information_schema`.`TABLES`.`INDEX_LENGTH` AS `total` from `INFORMATION_SCHEMA`.`TABLES` where `information_schema`.`TABLES`.`TABLE_SCHEMA` = 'myanimebot' and `information_schema`.`TABLES`.`TABLE_TYPE` = 'BASE TABLE' and (`information_schema`.`TABLES`.`TABLE_NAME` like 't\\_%' or `information_schema`.`TABLES`.`TABLE_NAME` like 'job\\_%') order by `information_schema`.`TABLES`.`TABLE_NAME`;
  597. -- Dumping structure for view myanimebot.v_ActiveUsers
  598. -- Removing temporary table and create final VIEW structure
  599. DROP TABLE IF EXISTS `v_ActiveUsers`;
  600. CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `v_ActiveUsers` AS select `t_users`.`mal_user` AS `user`,case when exists(select 1 from `t_feeds` where `t_feeds`.`user` = `t_users`.`mal_user` limit 1) then '1' else '0' end AS `active` from `t_users`;
  601. -- Dumping structure for view myanimebot.v_CountFeedsType
  602. -- Removing temporary table and create final VIEW structure
  603. DROP TABLE IF EXISTS `v_CountFeedsType`;
  604. CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `v_CountFeedsType` AS select `t_feeds`.`type` AS `type`,count(`t_feeds`.`id`) AS `total` from `t_feeds` where `t_feeds`.`type` <> 'N/A' group by `t_feeds`.`type` order by count(`t_feeds`.`id`) desc;
  605. -- Dumping structure for view myanimebot.v_CountMediaType
  606. -- Removing temporary table and create final VIEW structure
  607. DROP TABLE IF EXISTS `v_CountMediaType`;
  608. CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `v_CountMediaType` AS select `t_animes`.`media` AS `media`,count(`t_animes`.`media`) AS `total` from `t_animes` group by `t_animes`.`media`;
  609. -- Dumping structure for view myanimebot.v_DailyHistory
  610. -- Removing temporary table and create final VIEW structure
  611. DROP TABLE IF EXISTS `v_DailyHistory`;
  612. CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `v_DailyHistory` AS select cast(`t_history`.`date` as date) AS `date`,max(`t_history`.`nbFeeds`) AS `nbFeeds`,max(`t_history`.`nbUniqueFeeds`) AS `nbUniqueFeeds`,max(`t_history`.`nbMedia`) AS `nbMedia`,max(`t_history`.`nbUsers`) AS `nbUsers`,max(`t_history`.`nbServers`) AS `nbServers`,round(avg(`t_history`.`nbDuplicateFeeds`),0) AS `nbDuplacteFeeds`,round(avg(`t_history`.`nbDuplicateMedia`),0) AS `nbDuplicateMedia`,round(avg(`t_history`.`nbEmptyThumbnail`),0) AS `nbEmptyThumbnail`,round(avg(`t_history`.`nbInactiveUsers`),0) AS `nbInactiveUsers`,round(avg(`t_history`.`spaceFeedsTable`),0) AS `spaceFeedsTable`,round(avg(`t_history`.`spaceAnimesTable`),0) AS `spaceAnimesTable`,round(avg(`t_history`.`spaceUsersTable`),0) AS `SpaceUsersTable`,round(avg(`t_history`.`spaceServersTable`),0) AS `SpaceServersTable`,round(avg(`t_history`.`dailyAveragePerUser`),0) AS `dailyAveragePerUser`,round(avg(`t_history`.`orphanMedias`),0) AS `orphanMedias`,round(avg(`t_history`.`nbMediaManga`),0) AS `nbMediaManga`,round(avg(`t_history`.`nbMediaAnime`),0) AS `nbMediaAnime`,round(avg(`t_history`.`nbLog`),0) AS `nbLog`,round(avg(`t_history`.`nbErrorLog`),0) AS `nbErrorLog` from `t_history` group by cast(`t_history`.`date` as date) order by cast(`t_history`.`date` as date) desc;
  613. -- Dumping structure for view myanimebot.v_Top
  614. -- Removing temporary table and create final VIEW structure
  615. DROP TABLE IF EXISTS `v_Top`;
  616. CREATE ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW `v_Top` AS select `t_feeds`.`user` AS `user`,count(`t_feeds`.`title`) AS `total` from `t_feeds` group by `t_feeds`.`user` order by count(`t_feeds`.`title`) desc;
  617. -- Dumping structure for view myanimebot.v_TopAnimes
  618. -- Removing temporary table and create final VIEW structure
  619. DROP TABLE IF EXISTS `v_TopAnimes`;
  620. CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `v_TopAnimes` AS select `t_feeds`.`title` AS `anime`,count(distinct `t_feeds`.`user`) AS `nbUser`,count(0) AS `total` from `t_feeds` group by `t_feeds`.`title` order by count(0) desc;
  621. -- Dumping structure for view myanimebot.v_TopUniqueAnimePerUsers
  622. -- Removing temporary table and create final VIEW structure
  623. DROP TABLE IF EXISTS `v_TopUniqueAnimePerUsers`;
  624. CREATE ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW `v_TopUniqueAnimePerUsers` AS select `t_feeds`.`user` AS `user`,`t_feeds`.`title` AS `title`,count(`t_feeds`.`title`) AS `count` from `t_feeds` group by `t_feeds`.`title`,`t_feeds`.`user` order by count(`t_feeds`.`title`) desc;
  625. -- Dumping structure for view myanimebot.v_TotalAnimes
  626. -- Removing temporary table and create final VIEW structure
  627. DROP TABLE IF EXISTS `v_TotalAnimes`;
  628. CREATE ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW `v_TotalAnimes` AS select count(0) AS `total` from `t_animes`;
  629. -- Dumping structure for view myanimebot.v_TotalDifferentAnimesPerUser
  630. -- Removing temporary table and create final VIEW structure
  631. DROP TABLE IF EXISTS `v_TotalDifferentAnimesPerUser`;
  632. CREATE ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW `v_TotalDifferentAnimesPerUser` AS select `t_feeds`.`user` AS `user`,count(distinct `t_feeds`.`title`) AS `total` from `t_feeds` group by `t_feeds`.`user` order by count(distinct `t_feeds`.`title`) desc;
  633. -- Dumping structure for view myanimebot.v_TotalFeeds
  634. -- Removing temporary table and create final VIEW structure
  635. DROP TABLE IF EXISTS `v_TotalFeeds`;
  636. CREATE ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW `v_TotalFeeds` AS select count(0) AS `total` from `t_feeds`;
  637. /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
  638. /*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
  639. /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;