From b89e8a60376633d061c2ba18da03c3e5311f918a Mon Sep 17 00:00:00 2001 From: Silvan <27845747+adlerhurst@users.noreply.github.com> Date: Wed, 18 Dec 2024 16:28:29 +0100 Subject: [PATCH] fix(setup): make step 41 repeatable (#9084) # Which Problems Are Solved setup step 41 cannot handle downgrades at the moment. This step writes the instance domain to the fields table. If there are new instances created during the downgraded version is running there would be domain missing in the fields afterwards. # How the Problems Are Solved Make step 41 repeatable for each version --- cmd/setup/41.go | 6 +++++- cmd/setup/config.go | 1 - cmd/setup/setup.go | 5 +++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cmd/setup/41.go b/cmd/setup/41.go index 57c446e2d1..fa4a1d5a4b 100644 --- a/cmd/setup/41.go +++ b/cmd/setup/41.go @@ -36,5 +36,9 @@ func (mig *FillFieldsForInstanceDomains) Execute(ctx context.Context, _ eventsto } func (mig *FillFieldsForInstanceDomains) String() string { - return "41_fill_fields_for_instance_domains" + return "repeatable_fill_fields_for_instance_domains" +} + +func (f *FillFieldsForInstanceDomains) Check(lastRun map[string]interface{}) bool { + return true } diff --git a/cmd/setup/config.go b/cmd/setup/config.go index 6c0a355b94..34bc80d4a2 100644 --- a/cmd/setup/config.go +++ b/cmd/setup/config.go @@ -128,7 +128,6 @@ type Steps struct { s38BackChannelLogoutNotificationStart *BackChannelLogoutNotificationStart s40InitPushFunc *InitPushFunc s39DeleteStaleOrgFields *DeleteStaleOrgFields - s41FillFieldsForInstanceDomains *FillFieldsForInstanceDomains } func MustNewSteps(v *viper.Viper) *Steps { diff --git a/cmd/setup/setup.go b/cmd/setup/setup.go index b21ba31bce..ddf969fa66 100644 --- a/cmd/setup/setup.go +++ b/cmd/setup/setup.go @@ -171,7 +171,6 @@ func Setup(ctx context.Context, config *Config, steps *Steps, masterKey string) steps.s38BackChannelLogoutNotificationStart = &BackChannelLogoutNotificationStart{dbClient: esPusherDBClient, esClient: eventstoreClient} steps.s39DeleteStaleOrgFields = &DeleteStaleOrgFields{dbClient: esPusherDBClient} steps.s40InitPushFunc = &InitPushFunc{dbClient: esPusherDBClient} - steps.s41FillFieldsForInstanceDomains = &FillFieldsForInstanceDomains{eventstore: eventstoreClient} err = projection.Create(ctx, projectionDBClient, eventstoreClient, config.Projections, nil, nil, nil) logging.OnError(err).Fatal("unable to start projections") @@ -188,6 +187,9 @@ func Setup(ctx context.Context, config *Config, steps *Steps, masterKey string) es: eventstoreClient, Version: build.Version(), }, + &FillFieldsForInstanceDomains{ + eventstore: eventstoreClient, + }, } for _, step := range []migration.Migration{ @@ -219,7 +221,6 @@ func Setup(ctx context.Context, config *Config, steps *Steps, masterKey string) steps.s35AddPositionToIndexEsWm, steps.s36FillV2Milestones, steps.s38BackChannelLogoutNotificationStart, - steps.s41FillFieldsForInstanceDomains, } { mustExecuteMigration(ctx, eventstoreClient, step, "migration failed") }