mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
Add depth to zone schema and remove zone_tree
This commit is contained in:
parent
2161ce88fa
commit
d0f29d36bb
2 changed files with 4 additions and 10 deletions
|
|
@ -18,6 +18,7 @@ var (
|
|||
"name_ci",
|
||||
"is_global",
|
||||
"parent_id",
|
||||
"depth",
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -31,6 +32,7 @@ type Zone struct {
|
|||
NameCi *string `json:"name_ci"`
|
||||
IsGlobal bool `json:"is_global"`
|
||||
ParentId string `json:"parent_id"`
|
||||
Depth float64 `json:"depth"`
|
||||
}
|
||||
|
||||
func NewZone() connection.Row {
|
||||
|
|
@ -59,6 +61,7 @@ func (z *Zone) UpdateValues() []interface{} {
|
|||
z.NameCi,
|
||||
utils.Bool[z.IsGlobal],
|
||||
utils.Checksum(z.ParentId),
|
||||
z.Depth,
|
||||
)
|
||||
|
||||
return v
|
||||
|
|
|
|||
|
|
@ -14,18 +14,9 @@ CREATE TABLE zone (
|
|||
is_global enum('y','n') NOT NULL,
|
||||
parent_id binary(20) DEFAULT NULL COMMENT 'zone.id',
|
||||
|
||||
depth tinyint(3) unsigned NOT NULL,
|
||||
|
||||
PRIMARY KEY (id),
|
||||
INDEX idx_parent_id (parent_id),
|
||||
UNIQUE INDEX idx_env_id_id (env_id,id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;
|
||||
|
||||
CREATE TABLE zone_tree (
|
||||
parent_id binary(20) NOT NULL COMMENT 'zone.id',
|
||||
child_id binary(20) NOT NULL COMMENT 'zone.id',
|
||||
env_id binary(20) NOT NULL COMMENT 'env.id',
|
||||
depth tinyint(3) unsigned NOT NULL,
|
||||
|
||||
PRIMARY KEY (child_id,depth),
|
||||
UNIQUE INDEX zone_relation (child_id,parent_id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;
|
||||
Loading…
Reference in a new issue