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

(cherry picked from commit b89e8a6037)
This commit is contained in:
Silvan
2024-12-18 16:28:29 +01:00
committed by Livio Spring
parent 1e8756b139
commit ded9491326
3 changed files with 8 additions and 4 deletions

View File

@@ -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
}

View File

@@ -128,7 +128,6 @@ type Steps struct {
s38BackChannelLogoutNotificationStart *BackChannelLogoutNotificationStart
s40InitPushFunc *InitPushFunc
s39DeleteStaleOrgFields *DeleteStaleOrgFields
s41FillFieldsForInstanceDomains *FillFieldsForInstanceDomains
}
func MustNewSteps(v *viper.Viper) *Steps {

View File

@@ -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")
}