drop owner_removed column on user projections

This commit is contained in:
Tim Möhlmann 2023-11-14 14:51:55 +02:00
parent 1cf627c3f5
commit 22204260f1
19 changed files with 332 additions and 358 deletions

View File

@ -11,7 +11,7 @@ import (
) )
func (s *Server) GetMyEmail(ctx context.Context, _ *auth_pb.GetMyEmailRequest) (*auth_pb.GetMyEmailResponse, error) { func (s *Server) GetMyEmail(ctx context.Context, _ *auth_pb.GetMyEmailRequest) (*auth_pb.GetMyEmailResponse, error) {
email, err := s.query.GetHumanEmail(ctx, authz.GetCtxData(ctx).UserID, false) email, err := s.query.GetHumanEmail(ctx, authz.GetCtxData(ctx).UserID)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -11,7 +11,7 @@ import (
) )
func (s *Server) GetMyPhone(ctx context.Context, _ *auth_pb.GetMyPhoneRequest) (*auth_pb.GetMyPhoneResponse, error) { func (s *Server) GetMyPhone(ctx context.Context, _ *auth_pb.GetMyPhoneRequest) (*auth_pb.GetMyPhoneResponse, error) {
phone, err := s.query.GetHumanPhone(ctx, authz.GetCtxData(ctx).UserID, false) phone, err := s.query.GetHumanPhone(ctx, authz.GetCtxData(ctx).UserID)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -10,7 +10,7 @@ import (
) )
func (s *Server) GetMyProfile(ctx context.Context, req *auth_pb.GetMyProfileRequest) (*auth_pb.GetMyProfileResponse, error) { func (s *Server) GetMyProfile(ctx context.Context, req *auth_pb.GetMyProfileRequest) (*auth_pb.GetMyProfileResponse, error) {
profile, err := s.query.GetHumanProfile(ctx, authz.GetCtxData(ctx).UserID, false) profile, err := s.query.GetHumanProfile(ctx, authz.GetCtxData(ctx).UserID)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -128,7 +128,7 @@ func (s *Server) IsUserUnique(ctx context.Context, req *mgmt_pb.IsUserUniqueRequ
if !policy.UserLoginMustBeDomain { if !policy.UserLoginMustBeDomain {
orgID = "" orgID = ""
} }
unique, err := s.query.IsUserUnique(ctx, req.UserName, req.Email, orgID, false) unique, err := s.query.IsUserUnique(ctx, req.UserName, req.Email, orgID)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -406,7 +406,7 @@ func (s *Server) GetHumanProfile(ctx context.Context, req *mgmt_pb.GetHumanProfi
if err != nil { if err != nil {
return nil, err return nil, err
} }
profile, err := s.query.GetHumanProfile(ctx, req.UserId, false, owner) profile, err := s.query.GetHumanProfile(ctx, req.UserId, owner)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -440,7 +440,7 @@ func (s *Server) GetHumanEmail(ctx context.Context, req *mgmt_pb.GetHumanEmailRe
if err != nil { if err != nil {
return nil, err return nil, err
} }
email, err := s.query.GetHumanEmail(ctx, req.UserId, false, owner) email, err := s.query.GetHumanEmail(ctx, req.UserId, owner)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -506,7 +506,7 @@ func (s *Server) GetHumanPhone(ctx context.Context, req *mgmt_pb.GetHumanPhoneRe
if err != nil { if err != nil {
return nil, err return nil, err
} }
phone, err := s.query.GetHumanPhone(ctx, req.UserId, false, owner) phone, err := s.query.GetHumanPhone(ctx, req.UserId, owner)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -360,7 +360,7 @@ func (s *Server) checkIntentToken(token string, intentID string) error {
} }
func (s *Server) ListAuthenticationMethodTypes(ctx context.Context, req *user.ListAuthenticationMethodTypesRequest) (*user.ListAuthenticationMethodTypesResponse, error) { func (s *Server) ListAuthenticationMethodTypes(ctx context.Context, req *user.ListAuthenticationMethodTypesRequest) (*user.ListAuthenticationMethodTypesResponse, error) {
authMethods, err := s.query.ListActiveUserAuthMethodTypes(ctx, req.GetUserId(), false) authMethods, err := s.query.ListActiveUserAuthMethodTypes(ctx, req.GetUserId())
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -171,7 +171,7 @@ func (repo *TokenVerifierRepo) checkAuthentication(ctx context.Context, authMeth
if domain.HasMFA(authMethods) { if domain.HasMFA(authMethods) {
return nil return nil
} }
availableAuthMethods, forceMFA, forceMFALocalOnly, err := repo.Query.ListUserAuthMethodTypesRequired(setCallerCtx(ctx, userID), userID, false) availableAuthMethods, forceMFA, forceMFALocalOnly, err := repo.Query.ListUserAuthMethodTypesRequired(setCallerCtx(ctx, userID), userID)
if err != nil { if err != nil {
return err return err
} }

View File

@ -1,13 +1,13 @@
with usr as ( with usr as (
select id, creation_date, change_date, sequence, state, resource_owner, username select id, creation_date, change_date, sequence, state, resource_owner, username
from projections.users8 u from projections.users9 u
where id = $1 where id = $1
and instance_id = $2 and instance_id = $2
), ),
human as ( human as (
select $1 as user_id, row_to_json(r) as human from ( select $1 as user_id, row_to_json(r) as human from (
select first_name, last_name, nick_name, display_name, avatar_key, email, is_email_verified, phone, is_phone_verified select first_name, last_name, nick_name, display_name, avatar_key, email, is_email_verified, phone, is_phone_verified
from projections.users8_humans from projections.users9_humans
where user_id = $1 where user_id = $1
and instance_id = $2 and instance_id = $2
) r ) r
@ -15,7 +15,7 @@ human as (
machine as ( machine as (
select $1 as user_id, row_to_json(r) as machine from ( select $1 as user_id, row_to_json(r) as machine from (
select name, description select name, description
from projections.users8_machines from projections.users9_machines
where user_id = $1 where user_id = $1
and instance_id = $2 and instance_id = $2
) r ) r

View File

@ -21,21 +21,21 @@ var (
", members.user_id" + ", members.user_id" +
", members.roles" + ", members.roles" +
", projections.login_names2.login_name" + ", projections.login_names2.login_name" +
", projections.users8_humans.email" + ", projections.users9_humans.email" +
", projections.users8_humans.first_name" + ", projections.users9_humans.first_name" +
", projections.users8_humans.last_name" + ", projections.users9_humans.last_name" +
", projections.users8_humans.display_name" + ", projections.users9_humans.display_name" +
", projections.users8_machines.name" + ", projections.users9_machines.name" +
", projections.users8_humans.avatar_key" + ", projections.users9_humans.avatar_key" +
", projections.users8.type" + ", projections.users9.type" +
", COUNT(*) OVER () " + ", COUNT(*) OVER () " +
"FROM projections.instance_members3 AS members " + "FROM projections.instance_members3 AS members " +
"LEFT JOIN projections.users8_humans " + "LEFT JOIN projections.users9_humans " +
"ON members.user_id = projections.users8_humans.user_id AND members.instance_id = projections.users8_humans.instance_id " + "ON members.user_id = projections.users9_humans.user_id AND members.instance_id = projections.users9_humans.instance_id " +
"LEFT JOIN projections.users8_machines " + "LEFT JOIN projections.users9_machines " +
"ON members.user_id = projections.users8_machines.user_id AND members.instance_id = projections.users8_machines.instance_id " + "ON members.user_id = projections.users9_machines.user_id AND members.instance_id = projections.users9_machines.instance_id " +
"LEFT JOIN projections.users8 " + "LEFT JOIN projections.users9 " +
"ON members.user_id = projections.users8.id AND members.instance_id = projections.users8.instance_id " + "ON members.user_id = projections.users9.id AND members.instance_id = projections.users9.instance_id " +
"LEFT JOIN projections.login_names2 " + "LEFT JOIN projections.login_names2 " +
"ON members.user_id = projections.login_names2.user_id AND members.instance_id = projections.login_names2.instance_id " + "ON members.user_id = projections.login_names2.user_id AND members.instance_id = projections.login_names2.instance_id " +
"AS OF SYSTEM TIME '-1 ms' " + "AS OF SYSTEM TIME '-1 ms' " +

View File

@ -21,24 +21,24 @@ var (
", members.user_id" + ", members.user_id" +
", members.roles" + ", members.roles" +
", projections.login_names2.login_name" + ", projections.login_names2.login_name" +
", projections.users8_humans.email" + ", projections.users9_humans.email" +
", projections.users8_humans.first_name" + ", projections.users9_humans.first_name" +
", projections.users8_humans.last_name" + ", projections.users9_humans.last_name" +
", projections.users8_humans.display_name" + ", projections.users9_humans.display_name" +
", projections.users8_machines.name" + ", projections.users9_machines.name" +
", projections.users8_humans.avatar_key" + ", projections.users9_humans.avatar_key" +
", projections.users8.type" + ", projections.users9.type" +
", COUNT(*) OVER () " + ", COUNT(*) OVER () " +
"FROM projections.org_members3 AS members " + "FROM projections.org_members3 AS members " +
"LEFT JOIN projections.users8_humans " + "LEFT JOIN projections.users9_humans " +
"ON members.user_id = projections.users8_humans.user_id " + "ON members.user_id = projections.users9_humans.user_id " +
"AND members.instance_id = projections.users8_humans.instance_id " + "AND members.instance_id = projections.users9_humans.instance_id " +
"LEFT JOIN projections.users8_machines " + "LEFT JOIN projections.users9_machines " +
"ON members.user_id = projections.users8_machines.user_id " + "ON members.user_id = projections.users9_machines.user_id " +
"AND members.instance_id = projections.users8_machines.instance_id " + "AND members.instance_id = projections.users9_machines.instance_id " +
"LEFT JOIN projections.users8 " + "LEFT JOIN projections.users9 " +
"ON members.user_id = projections.users8.id " + "ON members.user_id = projections.users9.id " +
"AND members.instance_id = projections.users8.instance_id " + "AND members.instance_id = projections.users9.instance_id " +
"LEFT JOIN projections.login_names2 " + "LEFT JOIN projections.login_names2 " +
"ON members.user_id = projections.login_names2.user_id " + "ON members.user_id = projections.login_names2.user_id " +
"AND members.instance_id = projections.login_names2.instance_id " + "AND members.instance_id = projections.login_names2.instance_id " +

View File

@ -21,24 +21,24 @@ var (
", members.user_id" + ", members.user_id" +
", members.roles" + ", members.roles" +
", projections.login_names2.login_name" + ", projections.login_names2.login_name" +
", projections.users8_humans.email" + ", projections.users9_humans.email" +
", projections.users8_humans.first_name" + ", projections.users9_humans.first_name" +
", projections.users8_humans.last_name" + ", projections.users9_humans.last_name" +
", projections.users8_humans.display_name" + ", projections.users9_humans.display_name" +
", projections.users8_machines.name" + ", projections.users9_machines.name" +
", projections.users8_humans.avatar_key" + ", projections.users9_humans.avatar_key" +
", projections.users8.type" + ", projections.users9.type" +
", COUNT(*) OVER () " + ", COUNT(*) OVER () " +
"FROM projections.project_grant_members3 AS members " + "FROM projections.project_grant_members3 AS members " +
"LEFT JOIN projections.users8_humans " + "LEFT JOIN projections.users9_humans " +
"ON members.user_id = projections.users8_humans.user_id " + "ON members.user_id = projections.users9_humans.user_id " +
"AND members.instance_id = projections.users8_humans.instance_id " + "AND members.instance_id = projections.users9_humans.instance_id " +
"LEFT JOIN projections.users8_machines " + "LEFT JOIN projections.users9_machines " +
"ON members.user_id = projections.users8_machines.user_id " + "ON members.user_id = projections.users9_machines.user_id " +
"AND members.instance_id = projections.users8_machines.instance_id " + "AND members.instance_id = projections.users9_machines.instance_id " +
"LEFT JOIN projections.users8 " + "LEFT JOIN projections.users9 " +
"ON members.user_id = projections.users8.id " + "ON members.user_id = projections.users9.id " +
"AND members.instance_id = projections.users8.instance_id " + "AND members.instance_id = projections.users9.instance_id " +
"LEFT JOIN projections.login_names2 " + "LEFT JOIN projections.login_names2 " +
"ON members.user_id = projections.login_names2.user_id " + "ON members.user_id = projections.login_names2.user_id " +
"AND members.instance_id = projections.login_names2.instance_id " + "AND members.instance_id = projections.login_names2.instance_id " +

View File

@ -21,24 +21,24 @@ var (
", members.user_id" + ", members.user_id" +
", members.roles" + ", members.roles" +
", projections.login_names2.login_name" + ", projections.login_names2.login_name" +
", projections.users8_humans.email" + ", projections.users9_humans.email" +
", projections.users8_humans.first_name" + ", projections.users9_humans.first_name" +
", projections.users8_humans.last_name" + ", projections.users9_humans.last_name" +
", projections.users8_humans.display_name" + ", projections.users9_humans.display_name" +
", projections.users8_machines.name" + ", projections.users9_machines.name" +
", projections.users8_humans.avatar_key" + ", projections.users9_humans.avatar_key" +
", projections.users8.type" + ", projections.users9.type" +
", COUNT(*) OVER () " + ", COUNT(*) OVER () " +
"FROM projections.project_members3 AS members " + "FROM projections.project_members3 AS members " +
"LEFT JOIN projections.users8_humans " + "LEFT JOIN projections.users9_humans " +
"ON members.user_id = projections.users8_humans.user_id " + "ON members.user_id = projections.users9_humans.user_id " +
"AND members.instance_id = projections.users8_humans.instance_id " + "AND members.instance_id = projections.users9_humans.instance_id " +
"LEFT JOIN projections.users8_machines " + "LEFT JOIN projections.users9_machines " +
"ON members.user_id = projections.users8_machines.user_id " + "ON members.user_id = projections.users9_machines.user_id " +
"AND members.instance_id = projections.users8_machines.instance_id " + "AND members.instance_id = projections.users9_machines.instance_id " +
"LEFT JOIN projections.users8 " + "LEFT JOIN projections.users9 " +
"ON members.user_id = projections.users8.id " + "ON members.user_id = projections.users9.id " +
"AND members.instance_id = projections.users8.instance_id " + "AND members.instance_id = projections.users9.instance_id " +
"LEFT JOIN projections.login_names2 " + "LEFT JOIN projections.login_names2 " +
"ON members.user_id = projections.login_names2.user_id " + "ON members.user_id = projections.login_names2.user_id " +
"AND members.instance_id = projections.login_names2.instance_id " + "AND members.instance_id = projections.login_names2.instance_id " +

View File

@ -15,7 +15,7 @@ import (
) )
const ( const (
UserTable = "projections.users8" UserTable = "projections.users9"
UserHumanTable = UserTable + "_" + UserHumanSuffix UserHumanTable = UserTable + "_" + UserHumanSuffix
UserMachineTable = UserTable + "_" + UserMachineSuffix UserMachineTable = UserTable + "_" + UserMachineSuffix
UserNotifyTable = UserTable + "_" + UserNotifySuffix UserNotifyTable = UserTable + "_" + UserNotifySuffix
@ -29,7 +29,6 @@ const (
UserInstanceIDCol = "instance_id" UserInstanceIDCol = "instance_id"
UserUsernameCol = "username" UserUsernameCol = "username"
UserTypeCol = "type" UserTypeCol = "type"
UserOwnerRemovedCol = "owner_removed"
UserHumanSuffix = "humans" UserHumanSuffix = "humans"
HumanUserIDCol = "user_id" HumanUserIDCol = "user_id"
@ -94,12 +93,10 @@ func (*userProjection) Init() *old_handler.Check {
handler.NewColumn(UserInstanceIDCol, handler.ColumnTypeText), handler.NewColumn(UserInstanceIDCol, handler.ColumnTypeText),
handler.NewColumn(UserUsernameCol, handler.ColumnTypeText), handler.NewColumn(UserUsernameCol, handler.ColumnTypeText),
handler.NewColumn(UserTypeCol, handler.ColumnTypeEnum), handler.NewColumn(UserTypeCol, handler.ColumnTypeEnum),
handler.NewColumn(UserOwnerRemovedCol, handler.ColumnTypeBool, handler.Default(false)),
}, },
handler.NewPrimaryKey(UserInstanceIDCol, UserIDCol), handler.NewPrimaryKey(UserInstanceIDCol, UserIDCol),
handler.WithIndex(handler.NewIndex("username", []string{UserUsernameCol})), handler.WithIndex(handler.NewIndex("username", []string{UserUsernameCol})),
handler.WithIndex(handler.NewIndex("resource_owner", []string{UserResourceOwnerCol})), handler.WithIndex(handler.NewIndex("resource_owner", []string{UserResourceOwnerCol})),
handler.WithIndex(handler.NewIndex("owner_removed", []string{UserOwnerRemovedCol})),
), ),
handler.NewSuffixedTable([]*handler.InitColumn{ handler.NewSuffixedTable([]*handler.InitColumn{
handler.NewColumn(HumanUserIDCol, handler.ColumnTypeText), handler.NewColumn(HumanUserIDCol, handler.ColumnTypeText),

View File

@ -50,7 +50,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "INSERT INTO projections.users8 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)", expectedStmt: "INSERT INTO projections.users9 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
anyArg{}, anyArg{},
@ -64,7 +64,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "INSERT INTO projections.users8_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", expectedStmt: "INSERT INTO projections.users9_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"instance-id", "instance-id",
@ -79,7 +79,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "INSERT INTO projections.users8_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)", expectedStmt: "INSERT INTO projections.users9_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"instance-id", "instance-id",
@ -119,7 +119,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "INSERT INTO projections.users8 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)", expectedStmt: "INSERT INTO projections.users9 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
anyArg{}, anyArg{},
@ -133,7 +133,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "INSERT INTO projections.users8_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", expectedStmt: "INSERT INTO projections.users9_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"instance-id", "instance-id",
@ -148,7 +148,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "INSERT INTO projections.users8_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)", expectedStmt: "INSERT INTO projections.users9_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"instance-id", "instance-id",
@ -183,7 +183,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "INSERT INTO projections.users8 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)", expectedStmt: "INSERT INTO projections.users9 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
anyArg{}, anyArg{},
@ -197,7 +197,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "INSERT INTO projections.users8_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", expectedStmt: "INSERT INTO projections.users9_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"instance-id", "instance-id",
@ -212,7 +212,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "INSERT INTO projections.users8_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)", expectedStmt: "INSERT INTO projections.users9_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"instance-id", "instance-id",
@ -252,7 +252,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "INSERT INTO projections.users8 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)", expectedStmt: "INSERT INTO projections.users9 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
anyArg{}, anyArg{},
@ -266,7 +266,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "INSERT INTO projections.users8_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", expectedStmt: "INSERT INTO projections.users9_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"instance-id", "instance-id",
@ -281,7 +281,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "INSERT INTO projections.users8_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)", expectedStmt: "INSERT INTO projections.users9_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"instance-id", "instance-id",
@ -321,7 +321,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "INSERT INTO projections.users8 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)", expectedStmt: "INSERT INTO projections.users9 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
anyArg{}, anyArg{},
@ -335,7 +335,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "INSERT INTO projections.users8_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", expectedStmt: "INSERT INTO projections.users9_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"instance-id", "instance-id",
@ -350,7 +350,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "INSERT INTO projections.users8_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)", expectedStmt: "INSERT INTO projections.users9_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"instance-id", "instance-id",
@ -385,7 +385,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "INSERT INTO projections.users8 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)", expectedStmt: "INSERT INTO projections.users9 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
anyArg{}, anyArg{},
@ -399,7 +399,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "INSERT INTO projections.users8_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", expectedStmt: "INSERT INTO projections.users9_humans (user_id, instance_id, first_name, last_name, nick_name, display_name, preferred_language, gender, email, phone) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"instance-id", "instance-id",
@ -414,7 +414,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "INSERT INTO projections.users8_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)", expectedStmt: "INSERT INTO projections.users9_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"instance-id", "instance-id",
@ -444,7 +444,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET state = $1 WHERE (id = $2) AND (instance_id = $3)", expectedStmt: "UPDATE projections.users9 SET state = $1 WHERE (id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
domain.UserStateInitial, domain.UserStateInitial,
"agg-id", "agg-id",
@ -472,7 +472,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET state = $1 WHERE (id = $2) AND (instance_id = $3)", expectedStmt: "UPDATE projections.users9 SET state = $1 WHERE (id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
domain.UserStateInitial, domain.UserStateInitial,
"agg-id", "agg-id",
@ -500,7 +500,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET state = $1 WHERE (id = $2) AND (instance_id = $3)", expectedStmt: "UPDATE projections.users9 SET state = $1 WHERE (id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
domain.UserStateActive, domain.UserStateActive,
"agg-id", "agg-id",
@ -528,7 +528,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET state = $1 WHERE (id = $2) AND (instance_id = $3)", expectedStmt: "UPDATE projections.users9 SET state = $1 WHERE (id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
domain.UserStateActive, domain.UserStateActive,
"agg-id", "agg-id",
@ -556,7 +556,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, state, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)", expectedStmt: "UPDATE projections.users9 SET (change_date, state, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
domain.UserStateLocked, domain.UserStateLocked,
@ -586,7 +586,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, state, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)", expectedStmt: "UPDATE projections.users9 SET (change_date, state, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
domain.UserStateActive, domain.UserStateActive,
@ -616,7 +616,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, state, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)", expectedStmt: "UPDATE projections.users9 SET (change_date, state, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
domain.UserStateInactive, domain.UserStateInactive,
@ -646,7 +646,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, state, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)", expectedStmt: "UPDATE projections.users9 SET (change_date, state, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
domain.UserStateActive, domain.UserStateActive,
@ -676,7 +676,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "DELETE FROM projections.users8 WHERE (id = $1) AND (instance_id = $2)", expectedStmt: "DELETE FROM projections.users9 WHERE (id = $1) AND (instance_id = $2)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"instance-id", "instance-id",
@ -705,7 +705,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, username, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)", expectedStmt: "UPDATE projections.users9 SET (change_date, username, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
"username", "username",
@ -737,7 +737,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, username, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)", expectedStmt: "UPDATE projections.users9 SET (change_date, username, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
"id@temporary.domain", "id@temporary.domain",
@ -774,7 +774,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
uint64(15), uint64(15),
@ -783,7 +783,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_humans SET (first_name, last_name, nick_name, display_name, preferred_language, gender) = ($1, $2, $3, $4, $5, $6) WHERE (user_id = $7) AND (instance_id = $8)", expectedStmt: "UPDATE projections.users9_humans SET (first_name, last_name, nick_name, display_name, preferred_language, gender) = ($1, $2, $3, $4, $5, $6) WHERE (user_id = $7) AND (instance_id = $8)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"first-name", "first-name",
"last-name", "last-name",
@ -823,7 +823,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
uint64(15), uint64(15),
@ -832,7 +832,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_humans SET (first_name, last_name, nick_name, display_name, preferred_language, gender) = ($1, $2, $3, $4, $5, $6) WHERE (user_id = $7) AND (instance_id = $8)", expectedStmt: "UPDATE projections.users9_humans SET (first_name, last_name, nick_name, display_name, preferred_language, gender) = ($1, $2, $3, $4, $5, $6) WHERE (user_id = $7) AND (instance_id = $8)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"first-name", "first-name",
"last-name", "last-name",
@ -867,7 +867,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
uint64(15), uint64(15),
@ -876,7 +876,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
domain.PhoneNumber("+41 00 000 00 00"), domain.PhoneNumber("+41 00 000 00 00"),
false, false,
@ -885,7 +885,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_notifications SET last_phone = $1 WHERE (user_id = $2) AND (instance_id = $3)", expectedStmt: "UPDATE projections.users9_notifications SET last_phone = $1 WHERE (user_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
&sql.NullString{String: "+41 00 000 00 00", Valid: true}, &sql.NullString{String: "+41 00 000 00 00", Valid: true},
"agg-id", "agg-id",
@ -915,7 +915,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
uint64(15), uint64(15),
@ -924,7 +924,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
domain.PhoneNumber("+41 00 000 00 00"), domain.PhoneNumber("+41 00 000 00 00"),
false, false,
@ -933,7 +933,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_notifications SET last_phone = $1 WHERE (user_id = $2) AND (instance_id = $3)", expectedStmt: "UPDATE projections.users9_notifications SET last_phone = $1 WHERE (user_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
&sql.NullString{String: "+41 00 000 00 00", Valid: true}, &sql.NullString{String: "+41 00 000 00 00", Valid: true},
"agg-id", "agg-id",
@ -961,7 +961,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
uint64(15), uint64(15),
@ -970,7 +970,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
nil, nil,
nil, nil,
@ -979,7 +979,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_notifications SET (last_phone, verified_phone) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9_notifications SET (last_phone, verified_phone) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
nil, nil,
nil, nil,
@ -1008,7 +1008,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
uint64(15), uint64(15),
@ -1017,7 +1017,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
nil, nil,
nil, nil,
@ -1026,7 +1026,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_notifications SET (last_phone, verified_phone) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9_notifications SET (last_phone, verified_phone) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
nil, nil,
nil, nil,
@ -1055,7 +1055,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
uint64(15), uint64(15),
@ -1064,7 +1064,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_humans SET is_phone_verified = $1 WHERE (user_id = $2) AND (instance_id = $3)", expectedStmt: "UPDATE projections.users9_humans SET is_phone_verified = $1 WHERE (user_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
true, true,
"agg-id", "agg-id",
@ -1072,7 +1072,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_notifications SET verified_phone = last_phone WHERE (user_id = $1) AND (instance_id = $2)", expectedStmt: "UPDATE projections.users9_notifications SET verified_phone = last_phone WHERE (user_id = $1) AND (instance_id = $2)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"instance-id", "instance-id",
@ -1099,7 +1099,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
uint64(15), uint64(15),
@ -1108,7 +1108,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_humans SET is_phone_verified = $1 WHERE (user_id = $2) AND (instance_id = $3)", expectedStmt: "UPDATE projections.users9_humans SET is_phone_verified = $1 WHERE (user_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
true, true,
"agg-id", "agg-id",
@ -1116,7 +1116,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_notifications SET verified_phone = last_phone WHERE (user_id = $1) AND (instance_id = $2)", expectedStmt: "UPDATE projections.users9_notifications SET verified_phone = last_phone WHERE (user_id = $1) AND (instance_id = $2)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"instance-id", "instance-id",
@ -1145,7 +1145,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
uint64(15), uint64(15),
@ -1154,7 +1154,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_humans SET (email, is_email_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9_humans SET (email, is_email_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
domain.EmailAddress("email@zitadel.com"), domain.EmailAddress("email@zitadel.com"),
false, false,
@ -1163,7 +1163,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_notifications SET last_email = $1 WHERE (user_id = $2) AND (instance_id = $3)", expectedStmt: "UPDATE projections.users9_notifications SET last_email = $1 WHERE (user_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
&sql.NullString{String: "email@zitadel.com", Valid: true}, &sql.NullString{String: "email@zitadel.com", Valid: true},
"agg-id", "agg-id",
@ -1193,7 +1193,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
uint64(15), uint64(15),
@ -1202,7 +1202,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_humans SET (email, is_email_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9_humans SET (email, is_email_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
domain.EmailAddress("email@zitadel.com"), domain.EmailAddress("email@zitadel.com"),
false, false,
@ -1211,7 +1211,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_notifications SET last_email = $1 WHERE (user_id = $2) AND (instance_id = $3)", expectedStmt: "UPDATE projections.users9_notifications SET last_email = $1 WHERE (user_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
&sql.NullString{String: "email@zitadel.com", Valid: true}, &sql.NullString{String: "email@zitadel.com", Valid: true},
"agg-id", "agg-id",
@ -1239,7 +1239,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
uint64(15), uint64(15),
@ -1248,7 +1248,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_humans SET is_email_verified = $1 WHERE (user_id = $2) AND (instance_id = $3)", expectedStmt: "UPDATE projections.users9_humans SET is_email_verified = $1 WHERE (user_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
true, true,
"agg-id", "agg-id",
@ -1256,7 +1256,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_notifications SET verified_email = last_email WHERE (user_id = $1) AND (instance_id = $2)", expectedStmt: "UPDATE projections.users9_notifications SET verified_email = last_email WHERE (user_id = $1) AND (instance_id = $2)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"instance-id", "instance-id",
@ -1283,7 +1283,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
uint64(15), uint64(15),
@ -1292,7 +1292,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_humans SET is_email_verified = $1 WHERE (user_id = $2) AND (instance_id = $3)", expectedStmt: "UPDATE projections.users9_humans SET is_email_verified = $1 WHERE (user_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
true, true,
"agg-id", "agg-id",
@ -1300,7 +1300,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_notifications SET verified_email = last_email WHERE (user_id = $1) AND (instance_id = $2)", expectedStmt: "UPDATE projections.users9_notifications SET verified_email = last_email WHERE (user_id = $1) AND (instance_id = $2)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"instance-id", "instance-id",
@ -1329,7 +1329,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
uint64(15), uint64(15),
@ -1338,7 +1338,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_humans SET avatar_key = $1 WHERE (user_id = $2) AND (instance_id = $3)", expectedStmt: "UPDATE projections.users9_humans SET avatar_key = $1 WHERE (user_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"users/agg-id/avatar", "users/agg-id/avatar",
"agg-id", "agg-id",
@ -1366,7 +1366,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
uint64(15), uint64(15),
@ -1375,7 +1375,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_humans SET avatar_key = $1 WHERE (user_id = $2) AND (instance_id = $3)", expectedStmt: "UPDATE projections.users9_humans SET avatar_key = $1 WHERE (user_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
nil, nil,
"agg-id", "agg-id",
@ -1406,7 +1406,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "INSERT INTO projections.users8 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)", expectedStmt: "INSERT INTO projections.users9 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
anyArg{}, anyArg{},
@ -1420,7 +1420,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "INSERT INTO projections.users8_machines (user_id, instance_id, name, description, access_token_type) VALUES ($1, $2, $3, $4, $5)", expectedStmt: "INSERT INTO projections.users9_machines (user_id, instance_id, name, description, access_token_type) VALUES ($1, $2, $3, $4, $5)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"instance-id", "instance-id",
@ -1454,7 +1454,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "INSERT INTO projections.users8 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)", expectedStmt: "INSERT INTO projections.users9 (id, creation_date, change_date, resource_owner, instance_id, state, sequence, username, type) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
anyArg{}, anyArg{},
@ -1468,7 +1468,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "INSERT INTO projections.users8_machines (user_id, instance_id, name, description, access_token_type) VALUES ($1, $2, $3, $4, $5)", expectedStmt: "INSERT INTO projections.users9_machines (user_id, instance_id, name, description, access_token_type) VALUES ($1, $2, $3, $4, $5)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
"instance-id", "instance-id",
@ -1501,7 +1501,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
uint64(15), uint64(15),
@ -1510,7 +1510,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_machines SET (name, description) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9_machines SET (name, description) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"machine-name", "machine-name",
"description", "description",
@ -1541,7 +1541,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
uint64(15), uint64(15),
@ -1550,7 +1550,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_machines SET name = $1 WHERE (user_id = $2) AND (instance_id = $3)", expectedStmt: "UPDATE projections.users9_machines SET name = $1 WHERE (user_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"machine-name", "machine-name",
"agg-id", "agg-id",
@ -1580,7 +1580,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
uint64(15), uint64(15),
@ -1589,7 +1589,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_machines SET description = $1 WHERE (user_id = $2) AND (instance_id = $3)", expectedStmt: "UPDATE projections.users9_machines SET description = $1 WHERE (user_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"description", "description",
"agg-id", "agg-id",
@ -1638,7 +1638,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
uint64(15), uint64(15),
@ -1647,7 +1647,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_machines SET has_secret = $1 WHERE (user_id = $2) AND (instance_id = $3)", expectedStmt: "UPDATE projections.users9_machines SET has_secret = $1 WHERE (user_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
true, true,
"agg-id", "agg-id",
@ -1675,7 +1675,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "UPDATE projections.users8 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)", expectedStmt: "UPDATE projections.users9 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
anyArg{}, anyArg{},
uint64(15), uint64(15),
@ -1684,7 +1684,7 @@ func TestUserProjection_reduces(t *testing.T) {
}, },
}, },
{ {
expectedStmt: "UPDATE projections.users8_machines SET has_secret = $1 WHERE (user_id = $2) AND (instance_id = $3)", expectedStmt: "UPDATE projections.users9_machines SET has_secret = $1 WHERE (user_id = $2) AND (instance_id = $3)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
false, false,
"agg-id", "agg-id",
@ -1712,7 +1712,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "DELETE FROM projections.users8 WHERE (instance_id = $1) AND (resource_owner = $2)", expectedStmt: "DELETE FROM projections.users9 WHERE (instance_id = $1) AND (resource_owner = $2)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"instance-id", "instance-id",
"agg-id", "agg-id",
@ -1739,7 +1739,7 @@ func TestUserProjection_reduces(t *testing.T) {
executer: &testExecuter{ executer: &testExecuter{
executions: []execution{ executions: []execution{
{ {
expectedStmt: "DELETE FROM projections.users8 WHERE (instance_id = $1)", expectedStmt: "DELETE FROM projections.users9 WHERE (instance_id = $1)",
expectedArgs: []interface{}{ expectedArgs: []interface{}{
"agg-id", "agg-id",
}, },

View File

@ -30,8 +30,8 @@ var (
` projections.sessions7.user_id,` + ` projections.sessions7.user_id,` +
` projections.sessions7.user_checked_at,` + ` projections.sessions7.user_checked_at,` +
` projections.login_names2.login_name,` + ` projections.login_names2.login_name,` +
` projections.users8_humans.display_name,` + ` projections.users9_humans.display_name,` +
` projections.users8.resource_owner,` + ` projections.users9.resource_owner,` +
` projections.sessions7.password_checked_at,` + ` projections.sessions7.password_checked_at,` +
` projections.sessions7.intent_checked_at,` + ` projections.sessions7.intent_checked_at,` +
` projections.sessions7.webauthn_checked_at,` + ` projections.sessions7.webauthn_checked_at,` +
@ -48,8 +48,8 @@ var (
` projections.sessions7.expiration` + ` projections.sessions7.expiration` +
` FROM projections.sessions7` + ` FROM projections.sessions7` +
` LEFT JOIN projections.login_names2 ON projections.sessions7.user_id = projections.login_names2.user_id AND projections.sessions7.instance_id = projections.login_names2.instance_id` + ` LEFT JOIN projections.login_names2 ON projections.sessions7.user_id = projections.login_names2.user_id AND projections.sessions7.instance_id = projections.login_names2.instance_id` +
` LEFT JOIN projections.users8_humans ON projections.sessions7.user_id = projections.users8_humans.user_id AND projections.sessions7.instance_id = projections.users8_humans.instance_id` + ` LEFT JOIN projections.users9_humans ON projections.sessions7.user_id = projections.users9_humans.user_id AND projections.sessions7.instance_id = projections.users9_humans.instance_id` +
` LEFT JOIN projections.users8 ON projections.sessions7.user_id = projections.users8.id AND projections.sessions7.instance_id = projections.users8.instance_id` + ` LEFT JOIN projections.users9 ON projections.sessions7.user_id = projections.users9.id AND projections.sessions7.instance_id = projections.users9.instance_id` +
` AS OF SYSTEM TIME '-1 ms'`) ` AS OF SYSTEM TIME '-1 ms'`)
expectedSessionsQuery = regexp.QuoteMeta(`SELECT projections.sessions7.id,` + expectedSessionsQuery = regexp.QuoteMeta(`SELECT projections.sessions7.id,` +
` projections.sessions7.creation_date,` + ` projections.sessions7.creation_date,` +
@ -61,8 +61,8 @@ var (
` projections.sessions7.user_id,` + ` projections.sessions7.user_id,` +
` projections.sessions7.user_checked_at,` + ` projections.sessions7.user_checked_at,` +
` projections.login_names2.login_name,` + ` projections.login_names2.login_name,` +
` projections.users8_humans.display_name,` + ` projections.users9_humans.display_name,` +
` projections.users8.resource_owner,` + ` projections.users9.resource_owner,` +
` projections.sessions7.password_checked_at,` + ` projections.sessions7.password_checked_at,` +
` projections.sessions7.intent_checked_at,` + ` projections.sessions7.intent_checked_at,` +
` projections.sessions7.webauthn_checked_at,` + ` projections.sessions7.webauthn_checked_at,` +
@ -75,8 +75,8 @@ var (
` COUNT(*) OVER ()` + ` COUNT(*) OVER ()` +
` FROM projections.sessions7` + ` FROM projections.sessions7` +
` LEFT JOIN projections.login_names2 ON projections.sessions7.user_id = projections.login_names2.user_id AND projections.sessions7.instance_id = projections.login_names2.instance_id` + ` LEFT JOIN projections.login_names2 ON projections.sessions7.user_id = projections.login_names2.user_id AND projections.sessions7.instance_id = projections.login_names2.instance_id` +
` LEFT JOIN projections.users8_humans ON projections.sessions7.user_id = projections.users8_humans.user_id AND projections.sessions7.instance_id = projections.users8_humans.instance_id` + ` LEFT JOIN projections.users9_humans ON projections.sessions7.user_id = projections.users9_humans.user_id AND projections.sessions7.instance_id = projections.users9_humans.instance_id` +
` LEFT JOIN projections.users8 ON projections.sessions7.user_id = projections.users8.id AND projections.sessions7.instance_id = projections.users8.instance_id` + ` LEFT JOIN projections.users9 ON projections.sessions7.user_id = projections.users9.id AND projections.sessions7.instance_id = projections.users9.instance_id` +
` AS OF SYSTEM TIME '-1 ms'`) ` AS OF SYSTEM TIME '-1 ms'`)
sessionCols = []string{ sessionCols = []string{

View File

@ -170,10 +170,6 @@ var (
name: projection.UserTypeCol, name: projection.UserTypeCol,
table: userTable, table: userTable,
} }
UserOwnerRemovedCol = Column{
name: projection.UserOwnerRemovedCol,
table: userTable,
}
userLoginNamesTable = loginNameTable.setAlias("login_names") userLoginNamesTable = loginNameTable.setAlias("login_names")
userLoginNamesUserIDCol = LoginNameUserIDCol.setTable(userLoginNamesTable) userLoginNamesUserIDCol = LoginNameUserIDCol.setTable(userLoginNamesTable)
@ -327,7 +323,6 @@ var (
) )
func addUserWithoutOwnerRemoved(eq map[string]interface{}) { func addUserWithoutOwnerRemoved(eq map[string]interface{}) {
eq[UserOwnerRemovedCol.identifier()] = false
eq[userLoginNamesOwnerRemovedUserCol.identifier()] = false eq[userLoginNamesOwnerRemovedUserCol.identifier()] = false
eq[userLoginNamesOwnerRemovedPolicyCol.identifier()] = false eq[userLoginNamesOwnerRemovedPolicyCol.identifier()] = false
eq[userLoginNamesOwnerRemovedDomainCol.identifier()] = false eq[userLoginNamesOwnerRemovedDomainCol.identifier()] = false
@ -397,7 +392,7 @@ func (q *Queries) GetUser(ctx context.Context, shouldTriggerBulk bool, withOwner
return user, err return user, err
} }
func (q *Queries) GetHumanProfile(ctx context.Context, userID string, withOwnerRemoved bool, queries ...SearchQuery) (profile *Profile, err error) { func (q *Queries) GetHumanProfile(ctx context.Context, userID string, queries ...SearchQuery) (profile *Profile, err error) {
ctx, span := tracing.NewSpan(ctx) ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }() defer func() { span.EndWithError(err) }()
@ -409,9 +404,6 @@ func (q *Queries) GetHumanProfile(ctx context.Context, userID string, withOwnerR
UserIDCol.identifier(): userID, UserIDCol.identifier(): userID,
UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID(), UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID(),
} }
if !withOwnerRemoved {
eq[UserOwnerRemovedCol.identifier()] = false
}
stmt, args, err := query.Where(eq).ToSql() stmt, args, err := query.Where(eq).ToSql()
if err != nil { if err != nil {
return nil, errors.ThrowInternal(err, "QUERY-Dgbg2", "Errors.Query.SQLStatment") return nil, errors.ThrowInternal(err, "QUERY-Dgbg2", "Errors.Query.SQLStatment")
@ -424,7 +416,7 @@ func (q *Queries) GetHumanProfile(ctx context.Context, userID string, withOwnerR
return profile, err return profile, err
} }
func (q *Queries) GetHumanEmail(ctx context.Context, userID string, withOwnerRemoved bool, queries ...SearchQuery) (email *Email, err error) { func (q *Queries) GetHumanEmail(ctx context.Context, userID string, queries ...SearchQuery) (email *Email, err error) {
ctx, span := tracing.NewSpan(ctx) ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }() defer func() { span.EndWithError(err) }()
@ -436,9 +428,6 @@ func (q *Queries) GetHumanEmail(ctx context.Context, userID string, withOwnerRem
UserIDCol.identifier(): userID, UserIDCol.identifier(): userID,
UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID(), UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID(),
} }
if !withOwnerRemoved {
eq[UserOwnerRemovedCol.identifier()] = false
}
stmt, args, err := query.Where(eq).ToSql() stmt, args, err := query.Where(eq).ToSql()
if err != nil { if err != nil {
return nil, errors.ThrowInternal(err, "QUERY-BHhj3", "Errors.Query.SQLStatment") return nil, errors.ThrowInternal(err, "QUERY-BHhj3", "Errors.Query.SQLStatment")
@ -451,7 +440,7 @@ func (q *Queries) GetHumanEmail(ctx context.Context, userID string, withOwnerRem
return email, err return email, err
} }
func (q *Queries) GetHumanPhone(ctx context.Context, userID string, withOwnerRemoved bool, queries ...SearchQuery) (phone *Phone, err error) { func (q *Queries) GetHumanPhone(ctx context.Context, userID string, queries ...SearchQuery) (phone *Phone, err error) {
ctx, span := tracing.NewSpan(ctx) ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }() defer func() { span.EndWithError(err) }()
@ -463,9 +452,6 @@ func (q *Queries) GetHumanPhone(ctx context.Context, userID string, withOwnerRem
UserIDCol.identifier(): userID, UserIDCol.identifier(): userID,
UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID(), UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID(),
} }
if !withOwnerRemoved {
eq[UserOwnerRemovedCol.identifier()] = false
}
stmt, args, err := query.Where(eq).ToSql() stmt, args, err := query.Where(eq).ToSql()
if err != nil { if err != nil {
return nil, errors.ThrowInternal(err, "QUERY-Dg43g", "Errors.Query.SQLStatment") return nil, errors.ThrowInternal(err, "QUERY-Dg43g", "Errors.Query.SQLStatment")
@ -566,7 +552,7 @@ func (q *Queries) SearchUsers(ctx context.Context, queries *UserSearchQueries, w
return users, err return users, err
} }
func (q *Queries) IsUserUnique(ctx context.Context, username, email, resourceOwner string, withOwnerRemoved bool) (isUnique bool, err error) { func (q *Queries) IsUserUnique(ctx context.Context, username, email, resourceOwner string) (isUnique bool, err error) {
ctx, span := tracing.NewSpan(ctx) ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }() defer func() { span.EndWithError(err) }()
@ -597,9 +583,6 @@ func (q *Queries) IsUserUnique(ctx context.Context, username, email, resourceOwn
query = q.toQuery(query) query = q.toQuery(query)
} }
eq := sq.Eq{UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID()} eq := sq.Eq{UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID()}
if !withOwnerRemoved {
eq[UserOwnerRemovedCol.identifier()] = false
}
stmt, args, err := query.Where(eq).ToSql() stmt, args, err := query.Where(eq).ToSql()
if err != nil { if err != nil {
return false, errors.ThrowInternal(err, "QUERY-Dg43g", "Errors.Query.SQLStatment") return false, errors.ThrowInternal(err, "QUERY-Dg43g", "Errors.Query.SQLStatment")

View File

@ -141,7 +141,7 @@ func (q *Queries) SearchUserAuthMethods(ctx context.Context, queries *UserAuthMe
return userAuthMethods, err return userAuthMethods, err
} }
func (q *Queries) ListActiveUserAuthMethodTypes(ctx context.Context, userID string, withOwnerRemoved bool) (userAuthMethodTypes *AuthMethodTypes, err error) { func (q *Queries) ListActiveUserAuthMethodTypes(ctx context.Context, userID string) (userAuthMethodTypes *AuthMethodTypes, err error) {
ctxData := authz.GetCtxData(ctx) ctxData := authz.GetCtxData(ctx)
if ctxData.UserID != userID { if ctxData.UserID != userID {
if err := q.checkPermission(ctx, domain.PermissionUserRead, ctxData.OrgID, userID); err != nil { if err := q.checkPermission(ctx, domain.PermissionUserRead, ctxData.OrgID, userID); err != nil {
@ -156,9 +156,6 @@ func (q *Queries) ListActiveUserAuthMethodTypes(ctx context.Context, userID stri
UserIDCol.identifier(): userID, UserIDCol.identifier(): userID,
UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID(), UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID(),
} }
if !withOwnerRemoved {
eq[UserOwnerRemovedCol.identifier()] = false
}
stmt, args, err := query.Where(eq).ToSql() stmt, args, err := query.Where(eq).ToSql()
if err != nil { if err != nil {
return nil, errors.ThrowInvalidArgument(err, "QUERY-Sfdrg", "Errors.Query.InvalidRequest") return nil, errors.ThrowInvalidArgument(err, "QUERY-Sfdrg", "Errors.Query.InvalidRequest")
@ -175,7 +172,7 @@ func (q *Queries) ListActiveUserAuthMethodTypes(ctx context.Context, userID stri
return userAuthMethodTypes, err return userAuthMethodTypes, err
} }
func (q *Queries) ListUserAuthMethodTypesRequired(ctx context.Context, userID string, withOwnerRemoved bool) (userAuthMethodTypes []domain.UserAuthMethodType, forceMFA, forceMFALocalOnly bool, err error) { func (q *Queries) ListUserAuthMethodTypesRequired(ctx context.Context, userID string) (userAuthMethodTypes []domain.UserAuthMethodType, forceMFA, forceMFALocalOnly bool, err error) {
ctxData := authz.GetCtxData(ctx) ctxData := authz.GetCtxData(ctx)
if ctxData.UserID != userID { if ctxData.UserID != userID {
if err := q.checkPermission(ctx, domain.PermissionUserRead, ctxData.OrgID, userID); err != nil { if err := q.checkPermission(ctx, domain.PermissionUserRead, ctxData.OrgID, userID); err != nil {
@ -190,9 +187,6 @@ func (q *Queries) ListUserAuthMethodTypesRequired(ctx context.Context, userID st
UserIDCol.identifier(): userID, UserIDCol.identifier(): userID,
UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID(), UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID(),
} }
if !withOwnerRemoved {
eq[UserOwnerRemovedCol.identifier()] = false
}
stmt, args, err := query.Where(eq).ToSql() stmt, args, err := query.Where(eq).ToSql()
if err != nil { if err != nil {
return nil, false, false, errors.ThrowInvalidArgument(err, "QUERY-E5ut4", "Errors.Query.InvalidRequest") return nil, false, false, errors.ThrowInvalidArgument(err, "QUERY-E5ut4", "Errors.Query.InvalidRequest")

View File

@ -39,38 +39,38 @@ var (
"method_type", "method_type",
"count", "count",
} }
prepareActiveAuthMethodTypesStmt = `SELECT projections.users8_notifications.password_set,` + prepareActiveAuthMethodTypesStmt = `SELECT projections.users9_notifications.password_set,` +
` auth_method_types.method_type,` + ` auth_method_types.method_type,` +
` user_idps_count.count` + ` user_idps_count.count` +
` FROM projections.users8` + ` FROM projections.users9` +
` LEFT JOIN projections.users8_notifications ON projections.users8.id = projections.users8_notifications.user_id AND projections.users8.instance_id = projections.users8_notifications.instance_id` + ` LEFT JOIN projections.users9_notifications ON projections.users9.id = projections.users9_notifications.user_id AND projections.users9.instance_id = projections.users9_notifications.instance_id` +
` LEFT JOIN (SELECT DISTINCT(auth_method_types.method_type), auth_method_types.user_id, auth_method_types.instance_id FROM projections.user_auth_methods4 AS auth_method_types` + ` LEFT JOIN (SELECT DISTINCT(auth_method_types.method_type), auth_method_types.user_id, auth_method_types.instance_id FROM projections.user_auth_methods4 AS auth_method_types` +
` WHERE auth_method_types.state = $1) AS auth_method_types` + ` WHERE auth_method_types.state = $1) AS auth_method_types` +
` ON auth_method_types.user_id = projections.users8.id AND auth_method_types.instance_id = projections.users8.instance_id` + ` ON auth_method_types.user_id = projections.users9.id AND auth_method_types.instance_id = projections.users9.instance_id` +
` LEFT JOIN (SELECT user_idps_count.user_id, user_idps_count.instance_id, COUNT(user_idps_count.user_id) AS count FROM projections.idp_user_links3 AS user_idps_count` + ` LEFT JOIN (SELECT user_idps_count.user_id, user_idps_count.instance_id, COUNT(user_idps_count.user_id) AS count FROM projections.idp_user_links3 AS user_idps_count` +
` GROUP BY user_idps_count.user_id, user_idps_count.instance_id) AS user_idps_count` + ` GROUP BY user_idps_count.user_id, user_idps_count.instance_id) AS user_idps_count` +
` ON user_idps_count.user_id = projections.users8.id AND user_idps_count.instance_id = projections.users8.instance_id` + ` ON user_idps_count.user_id = projections.users9.id AND user_idps_count.instance_id = projections.users9.instance_id` +
` AS OF SYSTEM TIME '-1 ms` ` AS OF SYSTEM TIME '-1 ms`
prepareActiveAuthMethodTypesCols = []string{ prepareActiveAuthMethodTypesCols = []string{
"password_set", "password_set",
"method_type", "method_type",
"idps_count", "idps_count",
} }
prepareAuthMethodTypesRequiredStmt = `SELECT projections.users8_notifications.password_set,` + prepareAuthMethodTypesRequiredStmt = `SELECT projections.users9_notifications.password_set,` +
` auth_method_types.method_type,` + ` auth_method_types.method_type,` +
` user_idps_count.count,` + ` user_idps_count.count,` +
` auth_methods_force_mfa.force_mfa,` + ` auth_methods_force_mfa.force_mfa,` +
` auth_methods_force_mfa.force_mfa_local_only` + ` auth_methods_force_mfa.force_mfa_local_only` +
` FROM projections.users8` + ` FROM projections.users9` +
` LEFT JOIN projections.users8_notifications ON projections.users8.id = projections.users8_notifications.user_id AND projections.users8.instance_id = projections.users8_notifications.instance_id` + ` LEFT JOIN projections.users9_notifications ON projections.users9.id = projections.users9_notifications.user_id AND projections.users9.instance_id = projections.users9_notifications.instance_id` +
` LEFT JOIN (SELECT DISTINCT(auth_method_types.method_type), auth_method_types.user_id, auth_method_types.instance_id FROM projections.user_auth_methods4 AS auth_method_types` + ` LEFT JOIN (SELECT DISTINCT(auth_method_types.method_type), auth_method_types.user_id, auth_method_types.instance_id FROM projections.user_auth_methods4 AS auth_method_types` +
` WHERE auth_method_types.state = $1) AS auth_method_types` + ` WHERE auth_method_types.state = $1) AS auth_method_types` +
` ON auth_method_types.user_id = projections.users8.id AND auth_method_types.instance_id = projections.users8.instance_id` + ` ON auth_method_types.user_id = projections.users9.id AND auth_method_types.instance_id = projections.users9.instance_id` +
` LEFT JOIN (SELECT user_idps_count.user_id, user_idps_count.instance_id, COUNT(user_idps_count.user_id) AS count FROM projections.idp_user_links3 AS user_idps_count` + ` LEFT JOIN (SELECT user_idps_count.user_id, user_idps_count.instance_id, COUNT(user_idps_count.user_id) AS count FROM projections.idp_user_links3 AS user_idps_count` +
` GROUP BY user_idps_count.user_id, user_idps_count.instance_id) AS user_idps_count` + ` GROUP BY user_idps_count.user_id, user_idps_count.instance_id) AS user_idps_count` +
` ON user_idps_count.user_id = projections.users8.id AND user_idps_count.instance_id = projections.users8.instance_id` + ` ON user_idps_count.user_id = projections.users9.id AND user_idps_count.instance_id = projections.users9.instance_id` +
` LEFT JOIN (SELECT auth_methods_force_mfa.force_mfa, auth_methods_force_mfa.force_mfa_local_only, auth_methods_force_mfa.instance_id, auth_methods_force_mfa.aggregate_id FROM projections.login_policies5 AS auth_methods_force_mfa ORDER BY auth_methods_force_mfa.is_default) AS auth_methods_force_mfa` + ` LEFT JOIN (SELECT auth_methods_force_mfa.force_mfa, auth_methods_force_mfa.force_mfa_local_only, auth_methods_force_mfa.instance_id, auth_methods_force_mfa.aggregate_id FROM projections.login_policies5 AS auth_methods_force_mfa ORDER BY auth_methods_force_mfa.is_default) AS auth_methods_force_mfa` +
` ON (auth_methods_force_mfa.aggregate_id = projections.users8.instance_id OR auth_methods_force_mfa.aggregate_id = projections.users8.resource_owner) AND auth_methods_force_mfa.instance_id = projections.users8.instance_id` + ` ON (auth_methods_force_mfa.aggregate_id = projections.users9.instance_id OR auth_methods_force_mfa.aggregate_id = projections.users9.resource_owner) AND auth_methods_force_mfa.instance_id = projections.users9.instance_id` +
` AS OF SYSTEM TIME '-1 ms ` AS OF SYSTEM TIME '-1 ms
` `
prepareAuthMethodTypesRequiredCols = []string{ prepareAuthMethodTypesRequiredCols = []string{

View File

@ -23,14 +23,14 @@ var (
", projections.user_grants3.roles" + ", projections.user_grants3.roles" +
", projections.user_grants3.state" + ", projections.user_grants3.state" +
", projections.user_grants3.user_id" + ", projections.user_grants3.user_id" +
", projections.users8.username" + ", projections.users9.username" +
", projections.users8.type" + ", projections.users9.type" +
", projections.users8.resource_owner" + ", projections.users9.resource_owner" +
", projections.users8_humans.first_name" + ", projections.users9_humans.first_name" +
", projections.users8_humans.last_name" + ", projections.users9_humans.last_name" +
", projections.users8_humans.email" + ", projections.users9_humans.email" +
", projections.users8_humans.display_name" + ", projections.users9_humans.display_name" +
", projections.users8_humans.avatar_key" + ", projections.users9_humans.avatar_key" +
", projections.login_names2.login_name" + ", projections.login_names2.login_name" +
", projections.user_grants3.resource_owner" + ", projections.user_grants3.resource_owner" +
", projections.orgs1.name" + ", projections.orgs1.name" +
@ -38,8 +38,8 @@ var (
", projections.user_grants3.project_id" + ", projections.user_grants3.project_id" +
", projections.projects3.name" + ", projections.projects3.name" +
" FROM projections.user_grants3" + " FROM projections.user_grants3" +
" LEFT JOIN projections.users8 ON projections.user_grants3.user_id = projections.users8.id AND projections.user_grants3.instance_id = projections.users8.instance_id" + " LEFT JOIN projections.users9 ON projections.user_grants3.user_id = projections.users9.id AND projections.user_grants3.instance_id = projections.users9.instance_id" +
" LEFT JOIN projections.users8_humans ON projections.user_grants3.user_id = projections.users8_humans.user_id AND projections.user_grants3.instance_id = projections.users8_humans.instance_id" + " LEFT JOIN projections.users9_humans ON projections.user_grants3.user_id = projections.users9_humans.user_id AND projections.user_grants3.instance_id = projections.users9_humans.instance_id" +
" LEFT JOIN projections.orgs1 ON projections.user_grants3.resource_owner = projections.orgs1.id AND projections.user_grants3.instance_id = projections.orgs1.instance_id" + " LEFT JOIN projections.orgs1 ON projections.user_grants3.resource_owner = projections.orgs1.id AND projections.user_grants3.instance_id = projections.orgs1.instance_id" +
" LEFT JOIN projections.projects3 ON projections.user_grants3.project_id = projections.projects3.id AND projections.user_grants3.instance_id = projections.projects3.instance_id" + " LEFT JOIN projections.projects3 ON projections.user_grants3.project_id = projections.projects3.id AND projections.user_grants3.instance_id = projections.projects3.instance_id" +
" LEFT JOIN projections.login_names2 ON projections.user_grants3.user_id = projections.login_names2.user_id AND projections.user_grants3.instance_id = projections.login_names2.instance_id" + " LEFT JOIN projections.login_names2 ON projections.user_grants3.user_id = projections.login_names2.user_id AND projections.user_grants3.instance_id = projections.login_names2.instance_id" +
@ -78,14 +78,14 @@ var (
", projections.user_grants3.roles" + ", projections.user_grants3.roles" +
", projections.user_grants3.state" + ", projections.user_grants3.state" +
", projections.user_grants3.user_id" + ", projections.user_grants3.user_id" +
", projections.users8.username" + ", projections.users9.username" +
", projections.users8.type" + ", projections.users9.type" +
", projections.users8.resource_owner" + ", projections.users9.resource_owner" +
", projections.users8_humans.first_name" + ", projections.users9_humans.first_name" +
", projections.users8_humans.last_name" + ", projections.users9_humans.last_name" +
", projections.users8_humans.email" + ", projections.users9_humans.email" +
", projections.users8_humans.display_name" + ", projections.users9_humans.display_name" +
", projections.users8_humans.avatar_key" + ", projections.users9_humans.avatar_key" +
", projections.login_names2.login_name" + ", projections.login_names2.login_name" +
", projections.user_grants3.resource_owner" + ", projections.user_grants3.resource_owner" +
", projections.orgs1.name" + ", projections.orgs1.name" +
@ -94,8 +94,8 @@ var (
", projections.projects3.name" + ", projections.projects3.name" +
", COUNT(*) OVER ()" + ", COUNT(*) OVER ()" +
" FROM projections.user_grants3" + " FROM projections.user_grants3" +
" LEFT JOIN projections.users8 ON projections.user_grants3.user_id = projections.users8.id AND projections.user_grants3.instance_id = projections.users8.instance_id" + " LEFT JOIN projections.users9 ON projections.user_grants3.user_id = projections.users9.id AND projections.user_grants3.instance_id = projections.users9.instance_id" +
" LEFT JOIN projections.users8_humans ON projections.user_grants3.user_id = projections.users8_humans.user_id AND projections.user_grants3.instance_id = projections.users8_humans.instance_id" + " LEFT JOIN projections.users9_humans ON projections.user_grants3.user_id = projections.users9_humans.user_id AND projections.user_grants3.instance_id = projections.users9_humans.instance_id" +
" LEFT JOIN projections.orgs1 ON projections.user_grants3.resource_owner = projections.orgs1.id AND projections.user_grants3.instance_id = projections.orgs1.instance_id" + " LEFT JOIN projections.orgs1 ON projections.user_grants3.resource_owner = projections.orgs1.id AND projections.user_grants3.instance_id = projections.orgs1.instance_id" +
" LEFT JOIN projections.projects3 ON projections.user_grants3.project_id = projections.projects3.id AND projections.user_grants3.instance_id = projections.projects3.instance_id" + " LEFT JOIN projections.projects3 ON projections.user_grants3.project_id = projections.projects3.id AND projections.user_grants3.instance_id = projections.projects3.instance_id" +
" LEFT JOIN projections.login_names2 ON projections.user_grants3.user_id = projections.login_names2.user_id AND projections.user_grants3.instance_id = projections.login_names2.instance_id" + " LEFT JOIN projections.login_names2 ON projections.user_grants3.user_id = projections.login_names2.user_id AND projections.user_grants3.instance_id = projections.login_names2.instance_id" +

View File

@ -22,43 +22,43 @@ var (
preferredLoginNameQuery = `SELECT preferred_login_name.user_id, preferred_login_name.login_name, preferred_login_name.instance_id, preferred_login_name.user_owner_removed, preferred_login_name.policy_owner_removed, preferred_login_name.domain_owner_removed` + preferredLoginNameQuery = `SELECT preferred_login_name.user_id, preferred_login_name.login_name, preferred_login_name.instance_id, preferred_login_name.user_owner_removed, preferred_login_name.policy_owner_removed, preferred_login_name.domain_owner_removed` +
` FROM projections.login_names2 AS preferred_login_name` + ` FROM projections.login_names2 AS preferred_login_name` +
` WHERE preferred_login_name.is_primary = $1` ` WHERE preferred_login_name.is_primary = $1`
userQuery = `SELECT projections.users8.id,` + userQuery = `SELECT projections.users9.id,` +
` projections.users8.creation_date,` + ` projections.users9.creation_date,` +
` projections.users8.change_date,` + ` projections.users9.change_date,` +
` projections.users8.resource_owner,` + ` projections.users9.resource_owner,` +
` projections.users8.sequence,` + ` projections.users9.sequence,` +
` projections.users8.state,` + ` projections.users9.state,` +
` projections.users8.type,` + ` projections.users9.type,` +
` projections.users8.username,` + ` projections.users9.username,` +
` login_names.loginnames,` + ` login_names.loginnames,` +
` preferred_login_name.login_name,` + ` preferred_login_name.login_name,` +
` projections.users8_humans.user_id,` + ` projections.users9_humans.user_id,` +
` projections.users8_humans.first_name,` + ` projections.users9_humans.first_name,` +
` projections.users8_humans.last_name,` + ` projections.users9_humans.last_name,` +
` projections.users8_humans.nick_name,` + ` projections.users9_humans.nick_name,` +
` projections.users8_humans.display_name,` + ` projections.users9_humans.display_name,` +
` projections.users8_humans.preferred_language,` + ` projections.users9_humans.preferred_language,` +
` projections.users8_humans.gender,` + ` projections.users9_humans.gender,` +
` projections.users8_humans.avatar_key,` + ` projections.users9_humans.avatar_key,` +
` projections.users8_humans.email,` + ` projections.users9_humans.email,` +
` projections.users8_humans.is_email_verified,` + ` projections.users9_humans.is_email_verified,` +
` projections.users8_humans.phone,` + ` projections.users9_humans.phone,` +
` projections.users8_humans.is_phone_verified,` + ` projections.users9_humans.is_phone_verified,` +
` projections.users8_machines.user_id,` + ` projections.users9_machines.user_id,` +
` projections.users8_machines.name,` + ` projections.users9_machines.name,` +
` projections.users8_machines.description,` + ` projections.users9_machines.description,` +
` projections.users8_machines.has_secret,` + ` projections.users9_machines.has_secret,` +
` projections.users8_machines.access_token_type,` + ` projections.users9_machines.access_token_type,` +
` COUNT(*) OVER ()` + ` COUNT(*) OVER ()` +
` FROM projections.users8` + ` FROM projections.users9` +
` LEFT JOIN projections.users8_humans ON projections.users8.id = projections.users8_humans.user_id AND projections.users8.instance_id = projections.users8_humans.instance_id` + ` LEFT JOIN projections.users9_humans ON projections.users9.id = projections.users9_humans.user_id AND projections.users9.instance_id = projections.users9_humans.instance_id` +
` LEFT JOIN projections.users8_machines ON projections.users8.id = projections.users8_machines.user_id AND projections.users8.instance_id = projections.users8_machines.instance_id` + ` LEFT JOIN projections.users9_machines ON projections.users9.id = projections.users9_machines.user_id AND projections.users9.instance_id = projections.users9_machines.instance_id` +
` LEFT JOIN` + ` LEFT JOIN` +
` (` + loginNamesQuery + `) AS login_names` + ` (` + loginNamesQuery + `) AS login_names` +
` ON login_names.user_id = projections.users8.id AND login_names.instance_id = projections.users8.instance_id` + ` ON login_names.user_id = projections.users9.id AND login_names.instance_id = projections.users9.instance_id` +
` LEFT JOIN` + ` LEFT JOIN` +
` (` + preferredLoginNameQuery + `) AS preferred_login_name` + ` (` + preferredLoginNameQuery + `) AS preferred_login_name` +
` ON preferred_login_name.user_id = projections.users8.id AND preferred_login_name.instance_id = projections.users8.instance_id` + ` ON preferred_login_name.user_id = projections.users9.id AND preferred_login_name.instance_id = projections.users9.instance_id` +
` AS OF SYSTEM TIME '-1 ms'` ` AS OF SYSTEM TIME '-1 ms'`
userCols = []string{ userCols = []string{
"id", "id",
@ -92,21 +92,21 @@ var (
"access_token_type", "access_token_type",
"count", "count",
} }
profileQuery = `SELECT projections.users8.id,` + profileQuery = `SELECT projections.users9.id,` +
` projections.users8.creation_date,` + ` projections.users9.creation_date,` +
` projections.users8.change_date,` + ` projections.users9.change_date,` +
` projections.users8.resource_owner,` + ` projections.users9.resource_owner,` +
` projections.users8.sequence,` + ` projections.users9.sequence,` +
` projections.users8_humans.user_id,` + ` projections.users9_humans.user_id,` +
` projections.users8_humans.first_name,` + ` projections.users9_humans.first_name,` +
` projections.users8_humans.last_name,` + ` projections.users9_humans.last_name,` +
` projections.users8_humans.nick_name,` + ` projections.users9_humans.nick_name,` +
` projections.users8_humans.display_name,` + ` projections.users9_humans.display_name,` +
` projections.users8_humans.preferred_language,` + ` projections.users9_humans.preferred_language,` +
` projections.users8_humans.gender,` + ` projections.users9_humans.gender,` +
` projections.users8_humans.avatar_key` + ` projections.users9_humans.avatar_key` +
` FROM projections.users8` + ` FROM projections.users9` +
` LEFT JOIN projections.users8_humans ON projections.users8.id = projections.users8_humans.user_id AND projections.users8.instance_id = projections.users8_humans.instance_id` + ` LEFT JOIN projections.users9_humans ON projections.users9.id = projections.users9_humans.user_id AND projections.users9.instance_id = projections.users9_humans.instance_id` +
` AS OF SYSTEM TIME '-1 ms'` ` AS OF SYSTEM TIME '-1 ms'`
profileCols = []string{ profileCols = []string{
"id", "id",
@ -123,16 +123,16 @@ var (
"gender", "gender",
"avatar_key", "avatar_key",
} }
emailQuery = `SELECT projections.users8.id,` + emailQuery = `SELECT projections.users9.id,` +
` projections.users8.creation_date,` + ` projections.users9.creation_date,` +
` projections.users8.change_date,` + ` projections.users9.change_date,` +
` projections.users8.resource_owner,` + ` projections.users9.resource_owner,` +
` projections.users8.sequence,` + ` projections.users9.sequence,` +
` projections.users8_humans.user_id,` + ` projections.users9_humans.user_id,` +
` projections.users8_humans.email,` + ` projections.users9_humans.email,` +
` projections.users8_humans.is_email_verified` + ` projections.users9_humans.is_email_verified` +
` FROM projections.users8` + ` FROM projections.users9` +
` LEFT JOIN projections.users8_humans ON projections.users8.id = projections.users8_humans.user_id AND projections.users8.instance_id = projections.users8_humans.instance_id` + ` LEFT JOIN projections.users9_humans ON projections.users9.id = projections.users9_humans.user_id AND projections.users9.instance_id = projections.users9_humans.instance_id` +
` AS OF SYSTEM TIME '-1 ms'` ` AS OF SYSTEM TIME '-1 ms'`
emailCols = []string{ emailCols = []string{
"id", "id",
@ -144,16 +144,16 @@ var (
"email", "email",
"is_email_verified", "is_email_verified",
} }
phoneQuery = `SELECT projections.users8.id,` + phoneQuery = `SELECT projections.users9.id,` +
` projections.users8.creation_date,` + ` projections.users9.creation_date,` +
` projections.users8.change_date,` + ` projections.users9.change_date,` +
` projections.users8.resource_owner,` + ` projections.users9.resource_owner,` +
` projections.users8.sequence,` + ` projections.users9.sequence,` +
` projections.users8_humans.user_id,` + ` projections.users9_humans.user_id,` +
` projections.users8_humans.phone,` + ` projections.users9_humans.phone,` +
` projections.users8_humans.is_phone_verified` + ` projections.users9_humans.is_phone_verified` +
` FROM projections.users8` + ` FROM projections.users9` +
` LEFT JOIN projections.users8_humans ON projections.users8.id = projections.users8_humans.user_id AND projections.users8.instance_id = projections.users8_humans.instance_id` + ` LEFT JOIN projections.users9_humans ON projections.users9.id = projections.users9_humans.user_id AND projections.users9.instance_id = projections.users9_humans.instance_id` +
` AS OF SYSTEM TIME '-1 ms'` ` AS OF SYSTEM TIME '-1 ms'`
phoneCols = []string{ phoneCols = []string{
"id", "id",
@ -165,14 +165,14 @@ var (
"phone", "phone",
"is_phone_verified", "is_phone_verified",
} }
userUniqueQuery = `SELECT projections.users8.id,` + userUniqueQuery = `SELECT projections.users9.id,` +
` projections.users8.state,` + ` projections.users9.state,` +
` projections.users8.username,` + ` projections.users9.username,` +
` projections.users8_humans.user_id,` + ` projections.users9_humans.user_id,` +
` projections.users8_humans.email,` + ` projections.users9_humans.email,` +
` projections.users8_humans.is_email_verified` + ` projections.users9_humans.is_email_verified` +
` FROM projections.users8` + ` FROM projections.users9` +
` LEFT JOIN projections.users8_humans ON projections.users8.id = projections.users8_humans.user_id AND projections.users8.instance_id = projections.users8_humans.instance_id` + ` LEFT JOIN projections.users9_humans ON projections.users9.id = projections.users9_humans.user_id AND projections.users9.instance_id = projections.users9_humans.instance_id` +
` AS OF SYSTEM TIME '-1 ms'` ` AS OF SYSTEM TIME '-1 ms'`
userUniqueCols = []string{ userUniqueCols = []string{
"id", "id",
@ -182,40 +182,40 @@ var (
"email", "email",
"is_email_verified", "is_email_verified",
} }
notifyUserQuery = `SELECT projections.users8.id,` + notifyUserQuery = `SELECT projections.users9.id,` +
` projections.users8.creation_date,` + ` projections.users9.creation_date,` +
` projections.users8.change_date,` + ` projections.users9.change_date,` +
` projections.users8.resource_owner,` + ` projections.users9.resource_owner,` +
` projections.users8.sequence,` + ` projections.users9.sequence,` +
` projections.users8.state,` + ` projections.users9.state,` +
` projections.users8.type,` + ` projections.users9.type,` +
` projections.users8.username,` + ` projections.users9.username,` +
` login_names.loginnames,` + ` login_names.loginnames,` +
` preferred_login_name.login_name,` + ` preferred_login_name.login_name,` +
` projections.users8_humans.user_id,` + ` projections.users9_humans.user_id,` +
` projections.users8_humans.first_name,` + ` projections.users9_humans.first_name,` +
` projections.users8_humans.last_name,` + ` projections.users9_humans.last_name,` +
` projections.users8_humans.nick_name,` + ` projections.users9_humans.nick_name,` +
` projections.users8_humans.display_name,` + ` projections.users9_humans.display_name,` +
` projections.users8_humans.preferred_language,` + ` projections.users9_humans.preferred_language,` +
` projections.users8_humans.gender,` + ` projections.users9_humans.gender,` +
` projections.users8_humans.avatar_key,` + ` projections.users9_humans.avatar_key,` +
` projections.users8_notifications.user_id,` + ` projections.users9_notifications.user_id,` +
` projections.users8_notifications.last_email,` + ` projections.users9_notifications.last_email,` +
` projections.users8_notifications.verified_email,` + ` projections.users9_notifications.verified_email,` +
` projections.users8_notifications.last_phone,` + ` projections.users9_notifications.last_phone,` +
` projections.users8_notifications.verified_phone,` + ` projections.users9_notifications.verified_phone,` +
` projections.users8_notifications.password_set,` + ` projections.users9_notifications.password_set,` +
` COUNT(*) OVER ()` + ` COUNT(*) OVER ()` +
` FROM projections.users8` + ` FROM projections.users9` +
` LEFT JOIN projections.users8_humans ON projections.users8.id = projections.users8_humans.user_id AND projections.users8.instance_id = projections.users8_humans.instance_id` + ` LEFT JOIN projections.users9_humans ON projections.users9.id = projections.users9_humans.user_id AND projections.users9.instance_id = projections.users9_humans.instance_id` +
` LEFT JOIN projections.users8_notifications ON projections.users8.id = projections.users8_notifications.user_id AND projections.users8.instance_id = projections.users8_notifications.instance_id` + ` LEFT JOIN projections.users9_notifications ON projections.users9.id = projections.users9_notifications.user_id AND projections.users9.instance_id = projections.users9_notifications.instance_id` +
` LEFT JOIN` + ` LEFT JOIN` +
` (` + loginNamesQuery + `) AS login_names` + ` (` + loginNamesQuery + `) AS login_names` +
` ON login_names.user_id = projections.users8.id AND login_names.instance_id = projections.users8.instance_id` + ` ON login_names.user_id = projections.users9.id AND login_names.instance_id = projections.users9.instance_id` +
` LEFT JOIN` + ` LEFT JOIN` +
` (` + preferredLoginNameQuery + `) AS preferred_login_name` + ` (` + preferredLoginNameQuery + `) AS preferred_login_name` +
` ON preferred_login_name.user_id = projections.users8.id AND preferred_login_name.instance_id = projections.users8.instance_id` + ` ON preferred_login_name.user_id = projections.users9.id AND preferred_login_name.instance_id = projections.users9.instance_id` +
` AS OF SYSTEM TIME '-1 ms'` ` AS OF SYSTEM TIME '-1 ms'`
notifyUserCols = []string{ notifyUserCols = []string{
"id", "id",
@ -246,43 +246,43 @@ var (
"password_set", "password_set",
"count", "count",
} }
usersQuery = `SELECT projections.users8.id,` + usersQuery = `SELECT projections.users9.id,` +
` projections.users8.creation_date,` + ` projections.users9.creation_date,` +
` projections.users8.change_date,` + ` projections.users9.change_date,` +
` projections.users8.resource_owner,` + ` projections.users9.resource_owner,` +
` projections.users8.sequence,` + ` projections.users9.sequence,` +
` projections.users8.state,` + ` projections.users9.state,` +
` projections.users8.type,` + ` projections.users9.type,` +
` projections.users8.username,` + ` projections.users9.username,` +
` login_names.loginnames,` + ` login_names.loginnames,` +
` preferred_login_name.login_name,` + ` preferred_login_name.login_name,` +
` projections.users8_humans.user_id,` + ` projections.users9_humans.user_id,` +
` projections.users8_humans.first_name,` + ` projections.users9_humans.first_name,` +
` projections.users8_humans.last_name,` + ` projections.users9_humans.last_name,` +
` projections.users8_humans.nick_name,` + ` projections.users9_humans.nick_name,` +
` projections.users8_humans.display_name,` + ` projections.users9_humans.display_name,` +
` projections.users8_humans.preferred_language,` + ` projections.users9_humans.preferred_language,` +
` projections.users8_humans.gender,` + ` projections.users9_humans.gender,` +
` projections.users8_humans.avatar_key,` + ` projections.users9_humans.avatar_key,` +
` projections.users8_humans.email,` + ` projections.users9_humans.email,` +
` projections.users8_humans.is_email_verified,` + ` projections.users9_humans.is_email_verified,` +
` projections.users8_humans.phone,` + ` projections.users9_humans.phone,` +
` projections.users8_humans.is_phone_verified,` + ` projections.users9_humans.is_phone_verified,` +
` projections.users8_machines.user_id,` + ` projections.users9_machines.user_id,` +
` projections.users8_machines.name,` + ` projections.users9_machines.name,` +
` projections.users8_machines.description,` + ` projections.users9_machines.description,` +
` projections.users8_machines.has_secret,` + ` projections.users9_machines.has_secret,` +
` projections.users8_machines.access_token_type,` + ` projections.users9_machines.access_token_type,` +
` COUNT(*) OVER ()` + ` COUNT(*) OVER ()` +
` FROM projections.users8` + ` FROM projections.users9` +
` LEFT JOIN projections.users8_humans ON projections.users8.id = projections.users8_humans.user_id AND projections.users8.instance_id = projections.users8_humans.instance_id` + ` LEFT JOIN projections.users9_humans ON projections.users9.id = projections.users9_humans.user_id AND projections.users9.instance_id = projections.users9_humans.instance_id` +
` LEFT JOIN projections.users8_machines ON projections.users8.id = projections.users8_machines.user_id AND projections.users8.instance_id = projections.users8_machines.instance_id` + ` LEFT JOIN projections.users9_machines ON projections.users9.id = projections.users9_machines.user_id AND projections.users9.instance_id = projections.users9_machines.instance_id` +
` LEFT JOIN` + ` LEFT JOIN` +
` (` + loginNamesQuery + `) AS login_names` + ` (` + loginNamesQuery + `) AS login_names` +
` ON login_names.user_id = projections.users8.id AND login_names.instance_id = projections.users8.instance_id` + ` ON login_names.user_id = projections.users9.id AND login_names.instance_id = projections.users9.instance_id` +
` LEFT JOIN` + ` LEFT JOIN` +
` (` + preferredLoginNameQuery + `) AS preferred_login_name` + ` (` + preferredLoginNameQuery + `) AS preferred_login_name` +
` ON preferred_login_name.user_id = projections.users8.id AND preferred_login_name.instance_id = projections.users8.instance_id` + ` ON preferred_login_name.user_id = projections.users9.id AND preferred_login_name.instance_id = projections.users9.instance_id` +
` AS OF SYSTEM TIME '-1 ms'` ` AS OF SYSTEM TIME '-1 ms'`
usersCols = []string{ usersCols = []string{
"id", "id",