diff --git a/internal/query/projection/user.go b/internal/query/projection/user.go index 791997528..dd8cde6d7 100644 --- a/internal/query/projection/user.go +++ b/internal/query/projection/user.go @@ -5,6 +5,7 @@ import ( "database/sql" "github.com/caos/logging" + "github.com/caos/zitadel/internal/domain" "github.com/caos/zitadel/internal/errors" "github.com/caos/zitadel/internal/eventstore" @@ -379,10 +380,13 @@ func (p *UserProjection) reduceHumanProfileChanged(event eventstore.EventReader) return nil, errors.ThrowInvalidArgument(nil, "HANDL-769v4", "reduce.wrong.event.type") } cols := make([]handler.Column, 0, 6) - cols = append(cols, - handler.NewCol(HumanFistNameCol, e.FirstName), - handler.NewCol(HumanLastNameCol, e.LastName), - ) + if e.FirstName != "" { + cols = append(cols, handler.NewCol(HumanFistNameCol, e.FirstName)) + } + + if e.LastName != "" { + cols = append(cols, handler.NewCol(HumanLastNameCol, e.LastName)) + } if e.NickName != nil { cols = append(cols, handler.NewCol(HumanNickNameCol, *e.NickName)) diff --git a/migrations/cockroach/V1.99__reset_user_projections.sql b/migrations/cockroach/V1.99__reset_user_projections.sql new file mode 100644 index 000000000..0e7ed009b --- /dev/null +++ b/migrations/cockroach/V1.99__reset_user_projections.sql @@ -0,0 +1,2 @@ +truncate zitadel.projections.users cascade; +update zitadel.projections.current_sequences set current_sequence = 0 where projection_name = 'zitadel.projections.users';