fix: migration from es v1 (#1462)

* handle old step1

* add migration ES V1 to operator
This commit is contained in:
Livio Amstutz
2021-03-24 09:30:45 +01:00
committed by GitHub
parent d5f54259d6
commit e7c11cb9e2
4 changed files with 26 additions and 13 deletions

View File

@@ -3,6 +3,7 @@ package iam
import (
"context"
"encoding/json"
"github.com/caos/zitadel/internal/eventstore"
"github.com/caos/zitadel/internal/domain"
@@ -34,6 +35,10 @@ func SetupStepMapper(event *repository.Event) (eventstore.EventReader, error) {
step := &SetupStepEvent{
BaseEvent: *eventstore.BaseEventFromRepo(event),
Done: eventstore.EventType(event.Type) == SetupDoneEventType,
Step: domain.Step1,
}
if len(event.Data) == 0 {
return step, nil
}
err := json.Unmarshal(event.Data, step)
if err != nil {