diff options
author | jackpoz <giacomopoz@gmail.com> | 2019-06-06 18:13:17 +0200 |
---|---|---|
committer | jackpoz <giacomopoz@gmail.com> | 2019-06-06 18:13:17 +0200 |
commit | 9fc4ff9dd29968c1d64f47df4e721b468ac87362 (patch) | |
tree | 071d0fc233c320e69a86059aa7c9386ac3a77af3 | |
parent | a45f26ef2dc6855f609fa89545c866a8d4ccfae8 (diff) |
DB: Add new view vw_log_history to show database logs in a better way
-rw-r--r-- | sql/base/auth_database.sql | 41 | ||||
-rw-r--r-- | sql/updates/auth/3.3.5/2019_06_06_00_auth.sql | 3 |
2 files changed, 42 insertions, 2 deletions
diff --git a/sql/base/auth_database.sql b/sql/base/auth_database.sql index 4e59d7a2e8a..90502f6547f 100644 --- a/sql/base/auth_database.sql +++ b/sql/base/auth_database.sql @@ -1780,7 +1780,8 @@ INSERT INTO `updates` VALUES ('2019_03_19_00_auth.sql','03BA8CFC60ACD5B874840A3E50F11CD2643730A0','ARCHIVED','2019-03-19 07:17:45',5), ('2019_04_15_00_auth.sql','EC67389946A24BFAA226B9DFCFEDB3BA095B4C42','ARCHIVED','2019-04-15 06:16:09',5), ('2019_04_27_00_auth.sql','84B1EB9CC9B09BAF55E6295D202EC57D99B1B60E','ARCHIVED','2019-04-27 18:07:18',0), -('2019_05_15_00_auth.sql','8A7B96E66D689DA63380654142FF60A1EE938697','ARCHIVED','2019-05-15 06:13:20',5); +('2019_05_15_00_auth.sql','8A7B96E66D689DA63380654142FF60A1EE938697','ARCHIVED','2019-05-15 06:13:20',5), +('2019_06_06_00_auth.sql','6DE8159E04BEE7BA0A4A81D72D160EB74934B6A5','ARCHIVED','2019-06-06 18:09:54',0); /*!40000 ALTER TABLE `updates` ENABLE KEYS */; UNLOCK TABLES; @@ -1836,6 +1837,42 @@ LOCK TABLES `uptime` WRITE; /*!40000 ALTER TABLE `uptime` DISABLE KEYS */; /*!40000 ALTER TABLE `uptime` ENABLE KEYS */; UNLOCK TABLES; + +-- +-- Temporary table structure for view `vw_log_history` +-- + +DROP TABLE IF EXISTS `vw_log_history`; +/*!50001 DROP VIEW IF EXISTS `vw_log_history`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `vw_log_history` AS SELECT + 1 AS `First Logged`, + 1 AS `Last Logged`, + 1 AS `Occurrences`, + 1 AS `Realm`, + 1 AS `type`, + 1 AS `level`, + 1 AS `string`*/; +SET character_set_client = @saved_cs_client; + +-- +-- Final view structure for view `vw_log_history` +-- + +/*!50001 DROP VIEW IF EXISTS `vw_log_history`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 */ +/*!50001 VIEW `vw_log_history` AS (select from_unixtime(min(`logs`.`time`)) AS `First Logged`,from_unixtime(max(`logs`.`time`)) AS `Last Logged`,count(0) AS `Occurrences`,`realmlist`.`name` AS `Realm`,`logs`.`type` AS `type`,`logs`.`level` AS `level`,`logs`.`string` AS `string` from (`logs` left join `realmlist` on((`logs`.`realm` = `realmlist`.`id`))) group by `logs`.`string`,`logs`.`type`,`logs`.`realm`) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -1846,4 +1883,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-05-15 6:13:21 +-- Dump completed on 2019-06-06 14:27:03 diff --git a/sql/updates/auth/3.3.5/2019_06_06_00_auth.sql b/sql/updates/auth/3.3.5/2019_06_06_00_auth.sql new file mode 100644 index 00000000000..7a63c9ea765 --- /dev/null +++ b/sql/updates/auth/3.3.5/2019_06_06_00_auth.sql @@ -0,0 +1,3 @@ +DROP VIEW IF EXISTS `vw_log_history`; + +CREATE VIEW `vw_log_history` AS (SELECT FROM_UNIXTIME(MIN(`logs`.`time`)) AS `First Logged` ,FROM_UNIXTIME(MAX(`logs`.`time`)) AS `Last Logged` ,COUNT(*) AS `Occurrences` ,`realmlist`.`name` AS `Realm` ,`logs`.`type` ,`logs`.`level` ,`logs`.`string` FROM `logs` LEFT JOIN realmlist ON `logs`.`realm` = `realmlist`.`id` GROUP BY `logs`.`string`, `logs`.`type`, `logs`.`realm`); |