From 7815b6d61f154a3972643e5517217ccbabb103cd Mon Sep 17 00:00:00 2001 From: Jonada Hoxha Date: Wed, 18 Dec 2024 14:13:06 +0100 Subject: [PATCH] Make cluster name nullable --- cmd/icinga-kubernetes/main.go | 2 +- pkg/schema/v1/cluster.go | 3 ++- schema/mysql/schema.sql | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/icinga-kubernetes/main.go b/cmd/icinga-kubernetes/main.go index 91fc818..6e267bf 100644 --- a/cmd/icinga-kubernetes/main.go +++ b/cmd/icinga-kubernetes/main.go @@ -211,7 +211,7 @@ func main() { clusterInstance := &schemav1.Cluster{ Uuid: schemav1.EnsureUUID(ns.UID), - Name: clusterName, + Name: schemav1.NewNullableString(clusterName), } ctx = cluster.NewClusterUuidContext(ctx, clusterInstance.Uuid) diff --git a/pkg/schema/v1/cluster.go b/pkg/schema/v1/cluster.go index 0c74679..18e9479 100644 --- a/pkg/schema/v1/cluster.go +++ b/pkg/schema/v1/cluster.go @@ -1,10 +1,11 @@ package v1 import ( + "database/sql" "github.com/icinga/icinga-go-library/types" ) type Cluster struct { Uuid types.UUID - Name string + Name sql.NullString } diff --git a/schema/mysql/schema.sql b/schema/mysql/schema.sql index 6d6ae0f..e59ee76 100644 --- a/schema/mysql/schema.sql +++ b/schema/mysql/schema.sql @@ -1,6 +1,6 @@ CREATE TABLE cluster ( uuid binary(16) NOT NULL, - name varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + name varchar(255) COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, PRIMARY KEY (uuid) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;