1
0

myanimebot-init.sql 34 KB

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