diff --git a/pkg/api/v1/database_types.go b/pkg/api/v1/database_types.go index 12786a3..5e6ecd8 100644 --- a/pkg/api/v1/database_types.go +++ b/pkg/api/v1/database_types.go @@ -36,6 +36,9 @@ const ( ) // DatabaseSpec is the specification of a Postgresql Database +// +kubebuilder:validation:XValidation:rule="!has(self.builtinLocale) || self.localeProvider == 'builtin'",message="builtinLocale is only available when localeProvider is set to `builtin`" +// +kubebuilder:validation:XValidation:rule="!has(self.icuLocale) || self.localeProvider == 'icu'",message="icuLocale is only available when localeProvider is set to `icu`" +// +kubebuilder:validation:XValidation:rule="!has(self.icuRules) || self.localeProvider == 'icu'",message="icuRules is only available when localeProvider is set to `icu`" type DatabaseSpec struct { // The corresponding cluster ClusterRef corev1.LocalObjectReference `json:"cluster"` @@ -67,44 +70,56 @@ type DatabaseSpec struct { Encoding string `json:"encoding,omitempty"` // The locale (cannot be changed) + // Sets the default collation order and character classification in the new database. // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="locale is immutable" // +optional Locale string `json:"locale,omitempty"` - // The locale provider (cannot be changed) - // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="locale_provider is immutable" + // The LOCALE_PROVIDER (cannot be changed) + // This option sets the locale provider for databases created in the new cluster. + // Available from PostgreSQL 16. + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="localeProvider is immutable" // +optional - LocaleProvider string `json:"locale_provider,omitempty"` + LocaleProvider string `json:"localeProvider,omitempty"` // The LC_COLLATE (cannot be changed) - // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="lc_collate is immutable" + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="localeCollate is immutable" // +optional - LcCollate string `json:"lc_collate,omitempty"` + LcCollate string `json:"localeCollate,omitempty"` // The LC_CTYPE (cannot be changed) - // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="lc_ctype is immutable" + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="localeCType is immutable" // +optional - LcCtype string `json:"lc_ctype,omitempty"` + LcCtype string `json:"localeCType,omitempty"` // The ICU_LOCALE (cannot be changed) - // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="icu_locale is immutable" + // Specifies the ICU locale when the ICU provider is used. + // This option requires `localeProvider` to be set to `icu`. + // Available from PostgreSQL 15. + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="icuLocale is immutable" // +optional - IcuLocale string `json:"icu_locale,omitempty"` + IcuLocale string `json:"icuLocale,omitempty"` // The ICU_RULES (cannot be changed) - // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="icu_rules is immutable" + // Specifies additional collation rules to customize the behavior of the default collation. + // This option requires `localeProvider` to be set to `icu`. + // Available from PostgreSQL 16. + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="icuRules is immutable" // +optional - IcuRules string `json:"icu_rules,omitempty"` + IcuRules string `json:"icuRules,omitempty"` // The BUILTIN_LOCALE (cannot be changed) - // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="builtin_locale is immutable" + // Specifies the locale name when the builtin provider is used. + // This option requires `localeProvider` to be set to `builtin`. + // Available from PostgreSQL 17. + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="builtinLocale is immutable" // +optional - BuiltinLocale string `json:"builtin_locale,omitempty"` + BuiltinLocale string `json:"builtinLocale,omitempty"` // The COLLATION_VERSION (cannot be changed) - // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="collation_version is immutable" + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="collationVersion is immutable" // +optional - CollationVersion string `json:"collation_version,omitempty"` + CollationVersion string `json:"collationVersion,omitempty"` // True when the database is a template // +optional