diff --git a/cmd/setup/11.go b/cmd/setup/11.go index 97f6bf6687..4745c71994 100644 --- a/cmd/setup/11.go +++ b/cmd/setup/11.go @@ -13,10 +13,16 @@ var ( ) type AddEventCreatedAt struct { + step10 *CorrectCreationDate dbClient *database.DB } func (mig *AddEventCreatedAt) Execute(ctx context.Context) error { + // execute step 10 again because events created after the first execution of step 10 + // could still have the wrong ordering of sequences and creation date + if err := mig.step10.Execute(ctx); err != nil { + return err + } _, err := mig.dbClient.ExecContext(ctx, addEventCreatedAt) return err } diff --git a/cmd/setup/setup.go b/cmd/setup/setup.go index 31df9f2657..59b7c5d6ba 100644 --- a/cmd/setup/setup.go +++ b/cmd/setup/setup.go @@ -91,7 +91,7 @@ func Setup(config *Config, steps *Steps, masterKey string) { steps.s8AuthTokens = &AuthTokenIndexes{dbClient: dbClient} steps.s9EventstoreIndexes2 = New09(dbClient) steps.CorrectCreationDate.dbClient = dbClient - steps.s11AddEventCreatedAt = &AddEventCreatedAt{dbClient: dbClient} + steps.s11AddEventCreatedAt = &AddEventCreatedAt{dbClient: dbClient, step10: steps.CorrectCreationDate} err = projection.Create(ctx, dbClient, eventstoreClient, config.Projections, nil, nil) logging.OnError(err).Fatal("unable to start projections")