mirror of
https://github.com/Icinga/icingadb.git
synced 2026-02-18 18:18:00 -05:00
Merge pull request #1063 from Icinga/schema-align-icinga2-data-structure-and-schema
Align Icinga 2 Types with SQL Representation
This commit is contained in:
commit
88c801bf5a
6 changed files with 74 additions and 28 deletions
|
|
@ -16,7 +16,7 @@ type Checkable struct {
|
|||
CheckTimeperiodId types.Binary `json:"check_timeperiod_id"`
|
||||
CheckRetryInterval float64 `json:"check_retry_interval"`
|
||||
TotalChildren types.Int `json:"total_children"`
|
||||
CheckTimeout float64 `json:"check_timeout"`
|
||||
CheckTimeout types.Float `json:"check_timeout"`
|
||||
CheckcommandName string `json:"checkcommand_name"`
|
||||
CheckcommandId types.Binary `json:"checkcommand_id"`
|
||||
CommandEndpointName string `json:"command_endpoint_name"`
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ type State struct {
|
|||
CheckCommandline types.String `json:"check_commandline"`
|
||||
CheckSource types.String `json:"check_source"`
|
||||
SchedulingSource types.String `json:"scheduling_source"`
|
||||
ExecutionTime float64 `json:"execution_time"`
|
||||
ExecutionTime types.Float `json:"execution_time"`
|
||||
HardState uint8 `json:"hard_state"`
|
||||
InDowntime types.Bool `json:"in_downtime"`
|
||||
AffectsChildren types.Bool `json:"affects_children"`
|
||||
|
|
@ -25,7 +25,7 @@ type State struct {
|
|||
IsReachable types.Bool `json:"is_reachable"`
|
||||
LastStateChange types.UnixMilli `json:"last_state_change"`
|
||||
LastUpdate types.UnixMilli `json:"last_update"`
|
||||
Latency float64 `json:"latency"`
|
||||
Latency types.Float `json:"latency"`
|
||||
LongOutput types.String `json:"long_output"`
|
||||
NextCheck types.UnixMilli `json:"next_check"`
|
||||
NextUpdate types.UnixMilli `json:"next_update"`
|
||||
|
|
@ -37,5 +37,5 @@ type State struct {
|
|||
Severity uint16 `json:"severity"`
|
||||
SoftState uint8 `json:"soft_state"`
|
||||
StateType string `json:"state_type"`
|
||||
CheckTimeout float64 `json:"check_timeout"`
|
||||
CheckTimeout types.Float `json:"check_timeout"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,9 +184,9 @@ CREATE TABLE host (
|
|||
check_timeperiod_name varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'timeperiod.name',
|
||||
check_timeperiod_id binary(20) DEFAULT NULL COMMENT 'timeperiod.id',
|
||||
|
||||
check_timeout int unsigned DEFAULT NULL,
|
||||
check_interval int unsigned NOT NULL,
|
||||
check_retry_interval int unsigned NOT NULL,
|
||||
check_timeout float DEFAULT NULL,
|
||||
check_interval float NOT NULL,
|
||||
check_retry_interval float NOT NULL,
|
||||
|
||||
total_children int unsigned DEFAULT NULL,
|
||||
|
||||
|
|
@ -318,9 +318,9 @@ CREATE TABLE host_state (
|
|||
|
||||
affects_children enum('n', 'y') NOT NULL,
|
||||
|
||||
execution_time int unsigned DEFAULT NULL,
|
||||
latency int unsigned DEFAULT NULL,
|
||||
check_timeout int unsigned DEFAULT NULL,
|
||||
execution_time float DEFAULT NULL,
|
||||
latency float DEFAULT NULL,
|
||||
check_timeout float DEFAULT NULL,
|
||||
check_source text DEFAULT NULL,
|
||||
scheduling_source text DEFAULT NULL,
|
||||
|
||||
|
|
@ -357,9 +357,9 @@ CREATE TABLE service (
|
|||
check_timeperiod_name varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'timeperiod.name',
|
||||
check_timeperiod_id binary(20) DEFAULT NULL COMMENT 'timeperiod.id',
|
||||
|
||||
check_timeout int unsigned DEFAULT NULL,
|
||||
check_interval int unsigned NOT NULL,
|
||||
check_retry_interval int unsigned NOT NULL,
|
||||
check_timeout float DEFAULT NULL,
|
||||
check_interval float NOT NULL,
|
||||
check_retry_interval float NOT NULL,
|
||||
|
||||
total_children int unsigned DEFAULT NULL,
|
||||
|
||||
|
|
@ -492,9 +492,9 @@ CREATE TABLE service_state (
|
|||
|
||||
affects_children enum('n', 'y') NOT NULL,
|
||||
|
||||
execution_time int unsigned DEFAULT NULL,
|
||||
latency int unsigned DEFAULT NULL,
|
||||
check_timeout int unsigned DEFAULT NULL,
|
||||
execution_time float DEFAULT NULL,
|
||||
latency float DEFAULT NULL,
|
||||
check_timeout float DEFAULT NULL,
|
||||
check_source text DEFAULT NULL,
|
||||
scheduling_source text DEFAULT NULL,
|
||||
|
||||
|
|
|
|||
19
schema/mysql/upgrades/1.5.2-pr1063.sql
Normal file
19
schema/mysql/upgrades/1.5.2-pr1063.sql
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
ALTER TABLE host
|
||||
MODIFY COLUMN check_timeout float DEFAULT NULL,
|
||||
MODIFY COLUMN check_interval float NOT NULL,
|
||||
MODIFY COLUMN check_retry_interval float NOT NULL;
|
||||
|
||||
ALTER TABLE host_state
|
||||
MODIFY COLUMN execution_time float DEFAULT NULL,
|
||||
MODIFY COLUMN latency float DEFAULT NULL,
|
||||
MODIFY COLUMN check_timeout float DEFAULT NULL;
|
||||
|
||||
ALTER TABLE service
|
||||
MODIFY COLUMN check_timeout float DEFAULT NULL,
|
||||
MODIFY COLUMN check_interval float NOT NULL,
|
||||
MODIFY COLUMN check_retry_interval float NOT NULL;
|
||||
|
||||
ALTER TABLE service_state
|
||||
MODIFY COLUMN execution_time float DEFAULT NULL,
|
||||
MODIFY COLUMN latency float DEFAULT NULL,
|
||||
MODIFY COLUMN check_timeout float DEFAULT NULL;
|
||||
|
|
@ -210,9 +210,9 @@ CREATE TABLE host (
|
|||
check_timeperiod_name citext NOT NULL,
|
||||
check_timeperiod_id bytea20 DEFAULT NULL,
|
||||
|
||||
check_timeout uint DEFAULT NULL,
|
||||
check_interval uint NOT NULL,
|
||||
check_retry_interval uint NOT NULL,
|
||||
check_timeout float DEFAULT NULL,
|
||||
check_interval float NOT NULL,
|
||||
check_retry_interval float NOT NULL,
|
||||
|
||||
total_children uint DEFAULT NULL,
|
||||
|
||||
|
|
@ -431,9 +431,9 @@ CREATE TABLE host_state (
|
|||
|
||||
affects_children boolenum NOT NULL,
|
||||
|
||||
execution_time uint DEFAULT NULL,
|
||||
latency uint DEFAULT NULL,
|
||||
check_timeout uint DEFAULT NULL,
|
||||
execution_time float DEFAULT NULL,
|
||||
latency float DEFAULT NULL,
|
||||
check_timeout float DEFAULT NULL,
|
||||
check_source text DEFAULT NULL,
|
||||
scheduling_source text DEFAULT NULL,
|
||||
|
||||
|
|
@ -489,9 +489,9 @@ CREATE TABLE service (
|
|||
check_timeperiod_name citext NOT NULL,
|
||||
check_timeperiod_id bytea20 DEFAULT NULL,
|
||||
|
||||
check_timeout uint DEFAULT NULL,
|
||||
check_interval uint NOT NULL,
|
||||
check_retry_interval uint NOT NULL,
|
||||
check_timeout float DEFAULT NULL,
|
||||
check_interval float NOT NULL,
|
||||
check_retry_interval float NOT NULL,
|
||||
|
||||
total_children uint DEFAULT NULL,
|
||||
|
||||
|
|
@ -706,9 +706,9 @@ CREATE TABLE service_state (
|
|||
|
||||
affects_children boolenum NOT NULL,
|
||||
|
||||
execution_time uint DEFAULT NULL,
|
||||
latency uint DEFAULT NULL,
|
||||
check_timeout uint DEFAULT NULL,
|
||||
execution_time float DEFAULT NULL,
|
||||
latency float DEFAULT NULL,
|
||||
check_timeout float DEFAULT NULL,
|
||||
check_source text DEFAULT NULL,
|
||||
scheduling_source text DEFAULT NULL,
|
||||
|
||||
|
|
|
|||
27
schema/pgsql/upgrades/1.5.2-pr1063.sql
Normal file
27
schema/pgsql/upgrades/1.5.2-pr1063.sql
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
ALTER TABLE host
|
||||
ALTER COLUMN check_timeout TYPE float,
|
||||
ALTER COLUMN check_timeout SET DEFAULT NULL,
|
||||
ALTER COLUMN check_interval TYPE float,
|
||||
ALTER COLUMN check_retry_interval TYPE float;
|
||||
|
||||
ALTER TABLE host_state
|
||||
ALTER COLUMN execution_time TYPE float,
|
||||
ALTER COLUMN execution_time SET DEFAULT NULL,
|
||||
ALTER COLUMN latency TYPE float,
|
||||
ALTER COLUMN latency SET DEFAULT NULL,
|
||||
ALTER COLUMN check_timeout TYPE float,
|
||||
ALTER COLUMN check_timeout SET DEFAULT NULL;
|
||||
|
||||
ALTER TABLE service
|
||||
ALTER COLUMN check_timeout TYPE float,
|
||||
ALTER COLUMN check_timeout SET DEFAULT NULL,
|
||||
ALTER COLUMN check_interval TYPE float,
|
||||
ALTER COLUMN check_retry_interval TYPE float;
|
||||
|
||||
ALTER TABLE service_state
|
||||
ALTER COLUMN execution_time TYPE float,
|
||||
ALTER COLUMN execution_time SET DEFAULT NULL,
|
||||
ALTER COLUMN latency TYPE float,
|
||||
ALTER COLUMN latency SET DEFAULT NULL,
|
||||
ALTER COLUMN check_timeout TYPE float,
|
||||
ALTER COLUMN check_timeout SET DEFAULT NULL;
|
||||
Loading…
Reference in a new issue