feat: Feature flag for relational tables (#10599)

# Which Problems Are Solved

This PR introduces a new feature flag `EnableRelationalTables` that will
be used in following implementations to decide whether Zitadel should
use the relational model or the event sourcing one.

# TODO

  - [x] Implement flag at system level
- [x] Display the flag on console:
https://github.com/zitadel/zitadel/pull/10615

# How the Problems Are Solved

  - Implement loading the flag from config
- Add persistence of the flag through gRPC endpoint
(SetInstanceFeatures)
- Implement reading of the flag through gRPC endpoint
(GetInstanceFeatures)

# Additional Changes

Some minor refactoring to remove un-needed generics annotations

# Additional Context

- Closes #10574

---------

Co-authored-by: Silvan <[email protected]>
This commit is contained in:
Marco A.
2025-09-02 09:48:46 +00:00
committed by GitHub
co-authored by Silvan
parent e3dff2482e
commit 75a67be669
46 changed files with 669 additions and 91 deletions
+2
View File
@@ -22,6 +22,7 @@ const (
KeyLoginV2 Key = 13
KeyPermissionCheckV2 Key = 14
KeyConsoleUseV2UserApi Key = 15
KeyEnableRelationalTables Key = 16
)
//go:generate enumer -type Level -transform snake -trimprefix Level
@@ -49,6 +50,7 @@ type Features struct {
LoginV2 LoginV2 `json:"login_v2,omitempty"`
PermissionCheckV2 bool `json:"permission_check_v2,omitempty"`
ConsoleUseV2UserApi bool `json:"console_use_v2_user_api,omitempty"`
EnableRelationalTables bool `json:"enable_relational_tables,omitempty"`
}
/* Note: do not generate the stringer or enumer for this type, is it breaks existing events */
+31 -27
View File
@@ -16,8 +16,8 @@ const (
_KeyLowerName_2 = "improved_performance"
_KeyName_3 = "debug_oidc_parent_erroroidc_single_v1_session_termination"
_KeyLowerName_3 = "debug_oidc_parent_erroroidc_single_v1_session_termination"
_KeyName_4 = "enable_back_channel_logoutlogin_v2permission_check_v2console_use_v2_user_api"
_KeyLowerName_4 = "enable_back_channel_logoutlogin_v2permission_check_v2console_use_v2_user_api"
_KeyName_4 = "enable_back_channel_logoutlogin_v2permission_check_v2console_use_v2_user_apienable_relational_tables"
_KeyLowerName_4 = "enable_back_channel_logoutlogin_v2permission_check_v2console_use_v2_user_apienable_relational_tables"
)
var (
@@ -25,7 +25,7 @@ var (
_KeyIndex_1 = [...]uint8{0, 11, 25}
_KeyIndex_2 = [...]uint8{0, 20}
_KeyIndex_3 = [...]uint8{0, 23, 57}
_KeyIndex_4 = [...]uint8{0, 26, 34, 53, 76}
_KeyIndex_4 = [...]uint8{0, 26, 34, 53, 76, 100}
)
func (i Key) String() string {
@@ -40,7 +40,7 @@ func (i Key) String() string {
case 9 <= i && i <= 10:
i -= 9
return _KeyName_3[_KeyIndex_3[i]:_KeyIndex_3[i+1]]
case 12 <= i && i <= 15:
case 12 <= i && i <= 16:
i -= 12
return _KeyName_4[_KeyIndex_4[i]:_KeyIndex_4[i+1]]
default:
@@ -63,33 +63,36 @@ func _KeyNoOp() {
_ = x[KeyLoginV2-(13)]
_ = x[KeyPermissionCheckV2-(14)]
_ = x[KeyConsoleUseV2UserApi-(15)]
_ = x[KeyEnableRelationalTables-(16)]
}
var _KeyValues = []Key{KeyUnspecified, KeyLoginDefaultOrg, KeyUserSchema, KeyTokenExchange, KeyImprovedPerformance, KeyDebugOIDCParentError, KeyOIDCSingleV1SessionTermination, KeyEnableBackChannelLogout, KeyLoginV2, KeyPermissionCheckV2, KeyConsoleUseV2UserApi}
var _KeyValues = []Key{KeyUnspecified, KeyLoginDefaultOrg, KeyUserSchema, KeyTokenExchange, KeyImprovedPerformance, KeyDebugOIDCParentError, KeyOIDCSingleV1SessionTermination, KeyEnableBackChannelLogout, KeyLoginV2, KeyPermissionCheckV2, KeyConsoleUseV2UserApi, KeyEnableRelationalTables}
var _KeyNameToValueMap = map[string]Key{
_KeyName_0[0:11]: KeyUnspecified,
_KeyLowerName_0[0:11]: KeyUnspecified,
_KeyName_0[11:28]: KeyLoginDefaultOrg,
_KeyLowerName_0[11:28]: KeyLoginDefaultOrg,
_KeyName_1[0:11]: KeyUserSchema,
_KeyLowerName_1[0:11]: KeyUserSchema,
_KeyName_1[11:25]: KeyTokenExchange,
_KeyLowerName_1[11:25]: KeyTokenExchange,
_KeyName_2[0:20]: KeyImprovedPerformance,
_KeyLowerName_2[0:20]: KeyImprovedPerformance,
_KeyName_3[0:23]: KeyDebugOIDCParentError,
_KeyLowerName_3[0:23]: KeyDebugOIDCParentError,
_KeyName_3[23:57]: KeyOIDCSingleV1SessionTermination,
_KeyLowerName_3[23:57]: KeyOIDCSingleV1SessionTermination,
_KeyName_4[0:26]: KeyEnableBackChannelLogout,
_KeyLowerName_4[0:26]: KeyEnableBackChannelLogout,
_KeyName_4[26:34]: KeyLoginV2,
_KeyLowerName_4[26:34]: KeyLoginV2,
_KeyName_4[34:53]: KeyPermissionCheckV2,
_KeyLowerName_4[34:53]: KeyPermissionCheckV2,
_KeyName_4[53:76]: KeyConsoleUseV2UserApi,
_KeyLowerName_4[53:76]: KeyConsoleUseV2UserApi,
_KeyName_0[0:11]: KeyUnspecified,
_KeyLowerName_0[0:11]: KeyUnspecified,
_KeyName_0[11:28]: KeyLoginDefaultOrg,
_KeyLowerName_0[11:28]: KeyLoginDefaultOrg,
_KeyName_1[0:11]: KeyUserSchema,
_KeyLowerName_1[0:11]: KeyUserSchema,
_KeyName_1[11:25]: KeyTokenExchange,
_KeyLowerName_1[11:25]: KeyTokenExchange,
_KeyName_2[0:20]: KeyImprovedPerformance,
_KeyLowerName_2[0:20]: KeyImprovedPerformance,
_KeyName_3[0:23]: KeyDebugOIDCParentError,
_KeyLowerName_3[0:23]: KeyDebugOIDCParentError,
_KeyName_3[23:57]: KeyOIDCSingleV1SessionTermination,
_KeyLowerName_3[23:57]: KeyOIDCSingleV1SessionTermination,
_KeyName_4[0:26]: KeyEnableBackChannelLogout,
_KeyLowerName_4[0:26]: KeyEnableBackChannelLogout,
_KeyName_4[26:34]: KeyLoginV2,
_KeyLowerName_4[26:34]: KeyLoginV2,
_KeyName_4[34:53]: KeyPermissionCheckV2,
_KeyLowerName_4[34:53]: KeyPermissionCheckV2,
_KeyName_4[53:76]: KeyConsoleUseV2UserApi,
_KeyLowerName_4[53:76]: KeyConsoleUseV2UserApi,
_KeyName_4[76:100]: KeyEnableRelationalTables,
_KeyLowerName_4[76:100]: KeyEnableRelationalTables,
}
var _KeyNames = []string{
@@ -104,6 +107,7 @@ var _KeyNames = []string{
_KeyName_4[26:34],
_KeyName_4[34:53],
_KeyName_4[53:76],
_KeyName_4[76:100],
}
// KeyString retrieves an enum value from the enum constants string name.