Update schema
This commit is contained in:
3
Makefile
3
Makefile
@@ -4,8 +4,7 @@ generate: sqlc
|
|||||||
sqlc:
|
sqlc:
|
||||||
go tool sqlc compile
|
go tool sqlc compile
|
||||||
go tool sqlc generate
|
go tool sqlc generate
|
||||||
go tool gowrap gen -t opentelemetry -i QuerierTx -p ./ntpdb -o ./ntpdb/otel.go
|
go tool gowrap gen -g -t opentelemetry -i QuerierTx -p ./ntpdb -o ./ntpdb/otel.go
|
||||||
#go tool mockery --dir ntpdb --name QuerierTx --config /dev/null
|
|
||||||
|
|
||||||
sign:
|
sign:
|
||||||
drone sign --save ntppool/data-api
|
drone sign --save ntppool/data-api
|
||||||
|
|||||||
4
go.mod
4
go.mod
@@ -136,8 +136,8 @@ require (
|
|||||||
golang.org/x/text v0.27.0 // indirect
|
golang.org/x/text v0.27.0 // indirect
|
||||||
golang.org/x/time v0.12.0 // indirect
|
golang.org/x/time v0.12.0 // indirect
|
||||||
golang.org/x/tools v0.34.0 // indirect
|
golang.org/x/tools v0.34.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250728155136-f173205681a0 // indirect
|
google.golang.org/genproto/googleapis/api v0.0.0-20250804133106-a7a43d27e69b // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b // indirect
|
||||||
google.golang.org/grpc v1.74.2 // indirect
|
google.golang.org/grpc v1.74.2 // indirect
|
||||||
google.golang.org/protobuf v1.36.6 // indirect
|
google.golang.org/protobuf v1.36.6 // indirect
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||||
|
|||||||
4
go.sum
4
go.sum
@@ -362,8 +362,12 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
|
|||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250728155136-f173205681a0 h1:0UOBWO4dC+e51ui0NFKSPbkHHiQ4TmrEfEZMLDyRmY8=
|
google.golang.org/genproto/googleapis/api v0.0.0-20250728155136-f173205681a0 h1:0UOBWO4dC+e51ui0NFKSPbkHHiQ4TmrEfEZMLDyRmY8=
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250728155136-f173205681a0/go.mod h1:8ytArBbtOy2xfht+y2fqKd5DRDJRUQhqbyEnQ4bDChs=
|
google.golang.org/genproto/googleapis/api v0.0.0-20250728155136-f173205681a0/go.mod h1:8ytArBbtOy2xfht+y2fqKd5DRDJRUQhqbyEnQ4bDChs=
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20250804133106-a7a43d27e69b h1:ULiyYQ0FdsJhwwZUwbaXpZF5yUE3h+RA+gxvBu37ucc=
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20250804133106-a7a43d27e69b/go.mod h1:oDOGiMSXHL4sDTJvFvIB9nRQCGdLP1o/iVaqQK8zB+M=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0 h1:MAKi5q709QWfnkkpNQ0M12hYJ1+e8qYVDyowc4U1XZM=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0 h1:MAKi5q709QWfnkkpNQ0M12hYJ1+e8qYVDyowc4U1XZM=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b h1:zPKJod4w6F1+nRGDI9ubnXYhU9NSWoFAijkHkUXeTK8=
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
|
||||||
google.golang.org/grpc v1.74.2 h1:WoosgB65DlWVC9FqI82dGsZhWFNBSLjQ84bjROOpMu4=
|
google.golang.org/grpc v1.74.2 h1:WoosgB65DlWVC9FqI82dGsZhWFNBSLjQ84bjROOpMu4=
|
||||||
google.golang.org/grpc v1.74.2/go.mod h1:CtQ+BGjaAIXHs/5YS3i473GqwBBa1zGQNevxdeBEXrM=
|
google.golang.org/grpc v1.74.2/go.mod h1:CtQ+BGjaAIXHs/5YS3i473GqwBBa1zGQNevxdeBEXrM=
|
||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ const (
|
|||||||
ServerScoresStatusCandidate ServerScoresStatus = "candidate"
|
ServerScoresStatusCandidate ServerScoresStatus = "candidate"
|
||||||
ServerScoresStatusTesting ServerScoresStatus = "testing"
|
ServerScoresStatusTesting ServerScoresStatus = "testing"
|
||||||
ServerScoresStatusActive ServerScoresStatus = "active"
|
ServerScoresStatusActive ServerScoresStatus = "active"
|
||||||
|
ServerScoresStatusPaused ServerScoresStatus = "paused"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (e *ServerScoresStatus) Scan(src interface{}) error {
|
func (e *ServerScoresStatus) Scan(src interface{}) error {
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
package ntpdb
|
package ntpdb
|
||||||
|
|
||||||
//go:generate gowrap gen -p go.ntppool.org/data-api/ntpdb -i QuerierTx -t https://raw.githubusercontent.com/hexdigest/gowrap/6bd1bc023b4d2a619f30020924f258b8ff665a7a/templates/opentelemetry -o otel.go -l ""
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
|||||||
@@ -491,17 +491,20 @@ CREATE TABLE `server_scores` (
|
|||||||
`score_ts` datetime DEFAULT NULL,
|
`score_ts` datetime DEFAULT NULL,
|
||||||
`score_raw` double NOT NULL DEFAULT '0',
|
`score_raw` double NOT NULL DEFAULT '0',
|
||||||
`stratum` tinyint unsigned DEFAULT NULL,
|
`stratum` tinyint unsigned DEFAULT NULL,
|
||||||
`status` enum('candidate','testing','active') NOT NULL DEFAULT 'candidate',
|
`status` enum('candidate','testing','active','paused') NOT NULL DEFAULT 'candidate',
|
||||||
`queue_ts` datetime DEFAULT NULL,
|
`queue_ts` datetime DEFAULT NULL,
|
||||||
`created_on` datetime NOT NULL,
|
`created_on` datetime NOT NULL,
|
||||||
`modified_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
`modified_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
`constraint_violation_type` varchar(50) DEFAULT NULL,
|
`constraint_violation_type` varchar(50) DEFAULT NULL,
|
||||||
`constraint_violation_since` datetime DEFAULT NULL,
|
`constraint_violation_since` datetime DEFAULT NULL,
|
||||||
|
`last_constraint_check` datetime DEFAULT NULL,
|
||||||
|
`pause_reason` varchar(20) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `server_id` (`server_id`,`monitor_id`),
|
UNIQUE KEY `server_id` (`server_id`,`monitor_id`),
|
||||||
KEY `monitor_id` (`monitor_id`,`server_id`),
|
KEY `monitor_id` (`monitor_id`,`server_id`),
|
||||||
KEY `monitor_id_2` (`monitor_id`,`score_ts`),
|
KEY `monitor_id_2` (`monitor_id`,`score_ts`),
|
||||||
KEY `idx_constraint_violation` (`constraint_violation_type`,`constraint_violation_since`),
|
KEY `idx_constraint_violation` (`constraint_violation_type`,`constraint_violation_since`),
|
||||||
|
KEY `idx_paused_monitors` (`status`,`last_constraint_check`,`pause_reason`),
|
||||||
CONSTRAINT `server_score_monitor_fk` FOREIGN KEY (`monitor_id`) REFERENCES `monitors` (`id`),
|
CONSTRAINT `server_score_monitor_fk` FOREIGN KEY (`monitor_id`) REFERENCES `monitors` (`id`),
|
||||||
CONSTRAINT `server_score_server_id` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE
|
CONSTRAINT `server_score_server_id` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
|
||||||
@@ -898,4 +901,4 @@ CREATE TABLE `zones` (
|
|||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*M!100616 SET NOTE_VERBOSITY=@OLD_NOTE_VERBOSITY */;
|
/*M!100616 SET NOTE_VERBOSITY=@OLD_NOTE_VERBOSITY */;
|
||||||
|
|
||||||
-- Dump completed on 2025-08-03 0:43:29
|
-- Dump completed on 2025-08-06 4:26:05
|
||||||
|
|||||||
Reference in New Issue
Block a user