Private
Public Access
1
0

Update schema, Go 1.22.1, and dependencies
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-03-09 09:59:29 -08:00
parent 675e993353
commit 3cbef93607
10 changed files with 224 additions and 293 deletions

View File

@@ -1,4 +1,4 @@
-- MariaDB dump 10.19 Distrib 10.6.12-MariaDB, for Linux (x86_64)
-- MariaDB dump 10.19 Distrib 10.11.6-MariaDB, for Linux (x86_64)
--
-- Host: ntp-db-mysql-master.ntpdb.svc.cluster.local Database: askntp
-- ------------------------------------------------------
@@ -100,6 +100,7 @@ CREATE TABLE `accounts` (
`organization_url` varchar(150) DEFAULT NULL,
`public_profile` tinyint(1) NOT NULL DEFAULT '0',
`url_slug` varchar(150) DEFAULT NULL,
`flags` varchar(4096) NOT NULL DEFAULT '{}',
`created_on` datetime NOT NULL,
`modified_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`stripe_customer_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
@@ -229,24 +230,6 @@ CREATE TABLE `log_scores_archive_status` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `log_status`
--
DROP TABLE IF EXISTS `log_status`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `log_status` (
`server_id` int(10) unsigned NOT NULL,
`last_check` datetime NOT NULL,
`ts_archived` datetime NOT NULL,
PRIMARY KEY (`server_id`),
KEY `log_scores_server_ts_idx` (`server_id`,`last_check`),
KEY `last_check_idx` (`last_check`),
CONSTRAINT `log_status_server` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `logs`
--
@@ -306,6 +289,7 @@ CREATE TABLE `monitors` (
UNIQUE KEY `monitors_tls_name` (`tls_name`),
KEY `monitors_user_id` (`user_id`),
KEY `monitors_account_fk` (`account_id`),
KEY `type_status` (`type`,`status`),
CONSTRAINT `monitors_account_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`),
CONSTRAINT `monitors_user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -356,7 +340,7 @@ DROP TABLE IF EXISTS `scorer_status`;
CREATE TABLE `scorer_status` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`scorer_id` int(10) unsigned NOT NULL,
`log_score_id` bigint(20) unsigned DEFAULT NULL,
`log_score_id` bigint(20) unsigned NOT NULL,
`modified_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `scorer_log_score_id` (`log_score_id`),
@@ -447,6 +431,56 @@ CREATE TABLE `server_urls` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `server_verifications`
--
DROP TABLE IF EXISTS `server_verifications`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `server_verifications` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(10) unsigned NOT NULL,
`user_id` int(10) unsigned DEFAULT NULL,
`user_ip` varchar(45) NOT NULL DEFAULT '',
`indirect_ip` varchar(45) NOT NULL DEFAULT '',
`verified_on` datetime DEFAULT NULL,
`token` varchar(36) DEFAULT NULL,
`created_on` datetime NOT NULL,
`modified_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `server` (`server_id`),
UNIQUE KEY `token` (`token`),
KEY `server_verifications_ibfk_2` (`user_id`),
CONSTRAINT `server_verifications_ibfk_1` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE,
CONSTRAINT `server_verifications_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `server_verifications_history`
--
DROP TABLE IF EXISTS `server_verifications_history`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `server_verifications_history` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(10) unsigned NOT NULL,
`user_id` int(10) unsigned DEFAULT NULL,
`user_ip` varchar(45) NOT NULL DEFAULT '',
`indirect_ip` varchar(45) NOT NULL DEFAULT '',
`verified_on` datetime DEFAULT NULL,
`created_on` datetime NOT NULL,
`modified_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `server_verifications_history_ibfk_1` (`server_id`),
KEY `server_verifications_history_ibfk_2` (`user_id`),
CONSTRAINT `server_verifications_history_ibfk_1` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE,
CONSTRAINT `server_verifications_history_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `server_zones`
--
@@ -475,18 +509,20 @@ CREATE TABLE `servers` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ip` varchar(40) NOT NULL,
`ip_version` enum('v4','v6') NOT NULL DEFAULT 'v4',
`user_id` int(10) unsigned NOT NULL,
`user_id` int(10) unsigned DEFAULT NULL,
`account_id` int(10) unsigned DEFAULT NULL,
`hostname` varchar(255) DEFAULT NULL,
`stratum` tinyint(3) unsigned DEFAULT NULL,
`in_pool` tinyint(3) unsigned NOT NULL DEFAULT '0',
`in_server_list` tinyint(3) unsigned NOT NULL DEFAULT '0',
`netspeed` mediumint(8) unsigned NOT NULL DEFAULT '1000',
`netspeed` int(10) unsigned NOT NULL DEFAULT '10000',
`netspeed_target` int(10) unsigned NOT NULL DEFAULT '10000',
`created_on` datetime NOT NULL,
`updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`score_ts` datetime DEFAULT NULL,
`score_raw` double NOT NULL DEFAULT '0',
`deletion_on` date DEFAULT NULL,
`flags` varchar(4096) NOT NULL DEFAULT '{}',
PRIMARY KEY (`id`),
UNIQUE KEY `ip` (`ip`),
KEY `admin` (`user_id`),
@@ -526,8 +562,8 @@ DROP TABLE IF EXISTS `system_settings`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `system_settings` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`key` varchar(255) DEFAULT NULL,
`value` text,
`key` varchar(255) NOT NULL,
`value` text NOT NULL,
`created_on` datetime NOT NULL,
`modified_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
@@ -568,6 +604,8 @@ CREATE TABLE `user_identities` (
`provider` varchar(255) NOT NULL,
`data` text,
`email` varchar(255) DEFAULT NULL,
`created_on` datetime NOT NULL DEFAULT '2003-01-27 00:00:00',
`modified_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `profile_id` (`profile_id`),
KEY `user_identities_user_id` (`user_id`),
@@ -593,6 +631,28 @@ CREATE TABLE `user_privileges` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user_tasks`
--
DROP TABLE IF EXISTS `user_tasks`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_tasks` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned DEFAULT NULL,
`task` enum('download','delete') NOT NULL,
`status` text NOT NULL,
`traceid` varchar(32) NOT NULL DEFAULT '',
`execute_on` datetime DEFAULT NULL,
`created_on` datetime NOT NULL,
`modified_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `user_tasks_user_fk` (`user_id`),
CONSTRAINT `user_tasks_user_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `users`
--
@@ -606,6 +666,7 @@ CREATE TABLE `users` (
`name` varchar(255) DEFAULT NULL,
`username` varchar(40) DEFAULT NULL,
`public_profile` tinyint(1) NOT NULL DEFAULT '0',
`deletion_on` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `username` (`username`)
@@ -628,6 +689,7 @@ CREATE TABLE `vendor_zones` (
`client_type` enum('ntp','sntp','legacy') NOT NULL DEFAULT 'sntp',
`contact_information` text,
`request_information` text,
`device_information` text,
`device_count` int(10) unsigned DEFAULT NULL,
`opensource` tinyint(1) NOT NULL DEFAULT '0',
`opensource_info` text,
@@ -665,6 +727,7 @@ CREATE TABLE `zone_server_counts` (
`netspeed_active` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `zone_date` (`zone_id`,`date`,`ip_version`),
KEY `date_idx` (`date`,`zone_id`),
CONSTRAINT `zone_server_counts` FOREIGN KEY (`zone_id`) REFERENCES `zones` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -701,7 +764,7 @@ CREATE TABLE `zones` (
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`askntp`@`10.%` SQL SECURITY DEFINER */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `monitors_data` AS select `monitors`.`id` AS `id`,`monitors`.`account_id` AS `account_id`,`monitors`.`type` AS `type`,if((`monitors`.`type` = 'score'),`monitors`.`name`,substring_index(`monitors`.`tls_name`,'.',1)) AS `name`,`monitors`.`ip` AS `ip`,`monitors`.`ip_version` AS `ip_version`,`monitors`.`status` AS `status`,`monitors`.`client_version` AS `client_version`,`monitors`.`last_seen` AS `last_seen`,`monitors`.`last_submit` AS `last_submit` from `monitors` where (not((`monitors`.`tls_name` like '%.system'))) */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
@@ -716,4 +779,4 @@ CREATE TABLE `zones` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2023-05-03 5:59:38
-- Dump completed on 2024-03-04 4:03:49