diff --git a/cmd/defaults.yaml b/cmd/defaults.yaml index c95170e2bd..2d1d171b92 100644 --- a/cmd/defaults.yaml +++ b/cmd/defaults.yaml @@ -595,7 +595,7 @@ DefaultInstance: MaxAgeDays: 0 # ZITADEL_DEFAULTINSTANCE_PASSWORDAGEPOLICY_MAXAGEDAYS DomainPolicy: UserLoginMustBeDomain: false # ZITADEL_DEFAULTINSTANCE_DOMAINPOLICY_USERLOGINMUSTBEDOMAIN - ValidateOrgDomains: true # ZITADEL_DEFAULTINSTANCE_DOMAINPOLICY_VALIDATEORGDOMAINS + ValidateOrgDomains: false # ZITADEL_DEFAULTINSTANCE_DOMAINPOLICY_VALIDATEORGDOMAINS SMTPSenderAddressMatchesInstanceDomain: false # ZITADEL_DEFAULTINSTANCE_DOMAINPOLICY_SMTPSENDERADDRESSMATCHESINSTANCEDOMAIN LoginPolicy: AllowUsernamePassword: true # ZITADEL_DEFAULTINSTANCE_LOGINPOLICY_ALLOWUSERNAMEPASSWORD @@ -604,7 +604,7 @@ DefaultInstance: ForceMFA: false # ZITADEL_DEFAULTINSTANCE_LOGINPOLICY_FORCEMFA HidePasswordReset: false # ZITADEL_DEFAULTINSTANCE_LOGINPOLICY_HIDEPASSWORDRESET IgnoreUnknownUsernames: false # ZITADEL_DEFAULTINSTANCE_LOGINPOLICY_IGNOREUNKNOWNUSERNAMES - AllowDomainDiscovery: false # ZITADEL_DEFAULTINSTANCE_LOGINPOLICY_ALLOWDOMAINDISCOVERY + AllowDomainDiscovery: true # ZITADEL_DEFAULTINSTANCE_LOGINPOLICY_ALLOWDOMAINDISCOVERY # 1 is allowed, 0 is not allowed PasswordlessType: 1 # ZITADEL_DEFAULTINSTANCE_LOGINPOLICY_PASSWORDLESSTYPE # DefaultRedirectURL is empty by default because we use the Console UI diff --git a/cmd/setup/13.go b/cmd/setup/13.go new file mode 100644 index 0000000000..3b5df925b9 --- /dev/null +++ b/cmd/setup/13.go @@ -0,0 +1,26 @@ +package setup + +import ( + "context" + _ "embed" + + "github.com/zitadel/zitadel/internal/database" +) + +var ( + //go:embed 13/13_fix_quota_constraints.sql + fixQuotaConstraints string +) + +type FixQuotaConstraints struct { + dbClient *database.DB +} + +func (mig *FixQuotaConstraints) Execute(ctx context.Context) error { + _, err := mig.dbClient.ExecContext(ctx, fixQuotaConstraints) + return err +} + +func (mig *FixQuotaConstraints) String() string { + return "13_fix_quota_constraints" +} diff --git a/cmd/setup/13/13_fix_quota_constraints.sql b/cmd/setup/13/13_fix_quota_constraints.sql new file mode 100644 index 0000000000..d1f95d74ab --- /dev/null +++ b/cmd/setup/13/13_fix_quota_constraints.sql @@ -0,0 +1,4 @@ +ALTER TABLE IF EXISTS projections.quotas ALTER COLUMN from_anchor DROP NOT NULL; +ALTER TABLE IF EXISTS projections.quotas ALTER COLUMN amount DROP NOT NULL; +ALTER TABLE IF EXISTS projections.quotas ALTER COLUMN interval DROP NOT NULL; +ALTER TABLE IF EXISTS projections.quotas ALTER COLUMN limit_usage DROP NOT NULL; diff --git a/cmd/setup/config.go b/cmd/setup/config.go index 939fc9adf9..3290b59e6a 100644 --- a/cmd/setup/config.go +++ b/cmd/setup/config.go @@ -56,18 +56,19 @@ func MustNewConfig(v *viper.Viper) *Config { } type Steps struct { - s1ProjectionTable *ProjectionTable - s2AssetsTable *AssetTable - FirstInstance *FirstInstance - s4EventstoreIndexes *EventstoreIndexesNew - s5LastFailed *LastFailed - s6OwnerRemoveColumns *OwnerRemoveColumns - s7LogstoreTables *LogstoreTables - s8AuthTokens *AuthTokenIndexes - s9EventstoreIndexes2 *EventstoreIndexesNew - CorrectCreationDate *CorrectCreationDate - AddEventCreatedAt *AddEventCreatedAt - s12AddOTPColumns *AddOTPColumns + s1ProjectionTable *ProjectionTable + s2AssetsTable *AssetTable + FirstInstance *FirstInstance + s4EventstoreIndexes *EventstoreIndexesNew + s5LastFailed *LastFailed + s6OwnerRemoveColumns *OwnerRemoveColumns + s7LogstoreTables *LogstoreTables + s8AuthTokens *AuthTokenIndexes + s9EventstoreIndexes2 *EventstoreIndexesNew + CorrectCreationDate *CorrectCreationDate + AddEventCreatedAt *AddEventCreatedAt + s12AddOTPColumns *AddOTPColumns + s13FixQuotaProjection *FixQuotaConstraints } type encryptionKeyConfig struct { diff --git a/cmd/setup/setup.go b/cmd/setup/setup.go index 8097b61643..1efe703986 100644 --- a/cmd/setup/setup.go +++ b/cmd/setup/setup.go @@ -95,6 +95,7 @@ func Setup(config *Config, steps *Steps, masterKey string) { steps.AddEventCreatedAt.dbClient = dbClient steps.AddEventCreatedAt.step10 = steps.CorrectCreationDate steps.s12AddOTPColumns = &AddOTPColumns{dbClient: dbClient} + steps.s13FixQuotaProjection = &FixQuotaConstraints{dbClient: dbClient} err = projection.Create(ctx, dbClient, eventstoreClient, config.Projections, nil, nil) logging.OnError(err).Fatal("unable to start projections") @@ -137,6 +138,8 @@ func Setup(config *Config, steps *Steps, masterKey string) { logging.OnError(err).Fatal("unable to migrate step 11") err = migration.Migrate(ctx, eventstoreClient, steps.s12AddOTPColumns) logging.OnError(err).Fatal("unable to migrate step 12") + err = migration.Migrate(ctx, eventstoreClient, steps.s13FixQuotaProjection) + logging.OnError(err).Fatal("unable to migrate step 13") for _, repeatableStep := range repeatableSteps { err = migration.Migrate(ctx, eventstoreClient, repeatableStep) diff --git a/console/src/app/modules/header/header.component.html b/console/src/app/modules/header/header.component.html index 002efa3b0d..318d916c7d 100644 --- a/console/src/app/modules/header/header.component.html +++ b/console/src/app/modules/header/header.component.html @@ -195,7 +195,7 @@ - +