mirror of
https://github.com/zitadel/zitadel.git
synced 2025-05-06 11:56:49 +00:00
fix: remove userid unique constraint and fix user list query (#4632)
* fix: remove userid unique constraint and fix user list query * fix: improve instances query * improve user queries Co-authored-by: Silvan <silvan.reusser@gmail.com>
This commit is contained in:
parent
b432cf4963
commit
41c043bcd9
@ -20,18 +20,18 @@ var (
|
|||||||
", members.user_id" +
|
", members.user_id" +
|
||||||
", members.roles" +
|
", members.roles" +
|
||||||
", projections.login_names.login_name" +
|
", projections.login_names.login_name" +
|
||||||
", projections.users4_humans.email" +
|
", projections.users5_humans.email" +
|
||||||
", projections.users4_humans.first_name" +
|
", projections.users5_humans.first_name" +
|
||||||
", projections.users4_humans.last_name" +
|
", projections.users5_humans.last_name" +
|
||||||
", projections.users4_humans.display_name" +
|
", projections.users5_humans.display_name" +
|
||||||
", projections.users4_machines.name" +
|
", projections.users5_machines.name" +
|
||||||
", projections.users4_humans.avatar_key" +
|
", projections.users5_humans.avatar_key" +
|
||||||
", COUNT(*) OVER () " +
|
", COUNT(*) OVER () " +
|
||||||
"FROM projections.instance_members2 AS members " +
|
"FROM projections.instance_members2 AS members " +
|
||||||
"LEFT JOIN projections.users4_humans " +
|
"LEFT JOIN projections.users5_humans " +
|
||||||
"ON members.user_id = projections.users4_humans.user_id AND members.instance_id = projections.users4_humans.instance_id " +
|
"ON members.user_id = projections.users5_humans.user_id AND members.instance_id = projections.users5_humans.instance_id " +
|
||||||
"LEFT JOIN projections.users4_machines " +
|
"LEFT JOIN projections.users5_machines " +
|
||||||
"ON members.user_id = projections.users4_machines.user_id AND members.instance_id = projections.users4_machines.instance_id " +
|
"ON members.user_id = projections.users5_machines.user_id AND members.instance_id = projections.users5_machines.instance_id " +
|
||||||
"LEFT JOIN projections.login_names " +
|
"LEFT JOIN projections.login_names " +
|
||||||
"ON members.user_id = projections.login_names.user_id AND members.instance_id = projections.login_names.instance_id " +
|
"ON members.user_id = projections.login_names.user_id AND members.instance_id = projections.login_names.instance_id " +
|
||||||
"WHERE projections.login_names.is_primary = $1")
|
"WHERE projections.login_names.is_primary = $1")
|
||||||
|
@ -53,8 +53,8 @@ var (
|
|||||||
` projections.instance_domains.change_date, ` +
|
` projections.instance_domains.change_date, ` +
|
||||||
` projections.instance_domains.sequence` +
|
` projections.instance_domains.sequence` +
|
||||||
` FROM (SELECT projections.instances.id, COUNT(*) OVER () FROM projections.instances) AS f` +
|
` FROM (SELECT projections.instances.id, COUNT(*) OVER () FROM projections.instances) AS f` +
|
||||||
` LEFT JOIN projections.instances ON f.id = projections.instances.id AND f.id = projections.instances.id` +
|
` LEFT JOIN projections.instances ON f.id = projections.instances.id` +
|
||||||
` LEFT JOIN projections.instance_domains ON f.id = projections.instance_domains.instance_id AND f.id = projections.instance_domains.instance_id`
|
` LEFT JOIN projections.instance_domains ON f.id = projections.instance_domains.instance_id`
|
||||||
instancesCols = []string{
|
instancesCols = []string{
|
||||||
"count",
|
"count",
|
||||||
"id",
|
"id",
|
||||||
|
@ -20,20 +20,20 @@ var (
|
|||||||
", members.user_id" +
|
", members.user_id" +
|
||||||
", members.roles" +
|
", members.roles" +
|
||||||
", projections.login_names.login_name" +
|
", projections.login_names.login_name" +
|
||||||
", projections.users4_humans.email" +
|
", projections.users5_humans.email" +
|
||||||
", projections.users4_humans.first_name" +
|
", projections.users5_humans.first_name" +
|
||||||
", projections.users4_humans.last_name" +
|
", projections.users5_humans.last_name" +
|
||||||
", projections.users4_humans.display_name" +
|
", projections.users5_humans.display_name" +
|
||||||
", projections.users4_machines.name" +
|
", projections.users5_machines.name" +
|
||||||
", projections.users4_humans.avatar_key" +
|
", projections.users5_humans.avatar_key" +
|
||||||
", COUNT(*) OVER () " +
|
", COUNT(*) OVER () " +
|
||||||
"FROM projections.org_members2 AS members " +
|
"FROM projections.org_members2 AS members " +
|
||||||
"LEFT JOIN projections.users4_humans " +
|
"LEFT JOIN projections.users5_humans " +
|
||||||
"ON members.user_id = projections.users4_humans.user_id " +
|
"ON members.user_id = projections.users5_humans.user_id " +
|
||||||
"AND members.instance_id = projections.users4_humans.instance_id " +
|
"AND members.instance_id = projections.users5_humans.instance_id " +
|
||||||
"LEFT JOIN projections.users4_machines " +
|
"LEFT JOIN projections.users5_machines " +
|
||||||
"ON members.user_id = projections.users4_machines.user_id " +
|
"ON members.user_id = projections.users5_machines.user_id " +
|
||||||
"AND members.instance_id = projections.users4_machines.instance_id " +
|
"AND members.instance_id = projections.users5_machines.instance_id " +
|
||||||
"LEFT JOIN projections.login_names " +
|
"LEFT JOIN projections.login_names " +
|
||||||
"ON members.user_id = projections.login_names.user_id " +
|
"ON members.user_id = projections.login_names.user_id " +
|
||||||
"AND members.instance_id = projections.login_names.instance_id " +
|
"AND members.instance_id = projections.login_names.instance_id " +
|
||||||
|
@ -20,20 +20,20 @@ var (
|
|||||||
", members.user_id" +
|
", members.user_id" +
|
||||||
", members.roles" +
|
", members.roles" +
|
||||||
", projections.login_names.login_name" +
|
", projections.login_names.login_name" +
|
||||||
", projections.users4_humans.email" +
|
", projections.users5_humans.email" +
|
||||||
", projections.users4_humans.first_name" +
|
", projections.users5_humans.first_name" +
|
||||||
", projections.users4_humans.last_name" +
|
", projections.users5_humans.last_name" +
|
||||||
", projections.users4_humans.display_name" +
|
", projections.users5_humans.display_name" +
|
||||||
", projections.users4_machines.name" +
|
", projections.users5_machines.name" +
|
||||||
", projections.users4_humans.avatar_key" +
|
", projections.users5_humans.avatar_key" +
|
||||||
", COUNT(*) OVER () " +
|
", COUNT(*) OVER () " +
|
||||||
"FROM projections.project_grant_members2 AS members " +
|
"FROM projections.project_grant_members2 AS members " +
|
||||||
"LEFT JOIN projections.users4_humans " +
|
"LEFT JOIN projections.users5_humans " +
|
||||||
"ON members.user_id = projections.users4_humans.user_id " +
|
"ON members.user_id = projections.users5_humans.user_id " +
|
||||||
"AND members.instance_id = projections.users4_humans.instance_id " +
|
"AND members.instance_id = projections.users5_humans.instance_id " +
|
||||||
"LEFT JOIN projections.users4_machines " +
|
"LEFT JOIN projections.users5_machines " +
|
||||||
"ON members.user_id = projections.users4_machines.user_id " +
|
"ON members.user_id = projections.users5_machines.user_id " +
|
||||||
"AND members.instance_id = projections.users4_machines.instance_id " +
|
"AND members.instance_id = projections.users5_machines.instance_id " +
|
||||||
"LEFT JOIN projections.login_names " +
|
"LEFT JOIN projections.login_names " +
|
||||||
"ON members.user_id = projections.login_names.user_id " +
|
"ON members.user_id = projections.login_names.user_id " +
|
||||||
"AND members.instance_id = projections.login_names.instance_id " +
|
"AND members.instance_id = projections.login_names.instance_id " +
|
||||||
|
@ -20,20 +20,20 @@ var (
|
|||||||
", members.user_id" +
|
", members.user_id" +
|
||||||
", members.roles" +
|
", members.roles" +
|
||||||
", projections.login_names.login_name" +
|
", projections.login_names.login_name" +
|
||||||
", projections.users4_humans.email" +
|
", projections.users5_humans.email" +
|
||||||
", projections.users4_humans.first_name" +
|
", projections.users5_humans.first_name" +
|
||||||
", projections.users4_humans.last_name" +
|
", projections.users5_humans.last_name" +
|
||||||
", projections.users4_humans.display_name" +
|
", projections.users5_humans.display_name" +
|
||||||
", projections.users4_machines.name" +
|
", projections.users5_machines.name" +
|
||||||
", projections.users4_humans.avatar_key" +
|
", projections.users5_humans.avatar_key" +
|
||||||
", COUNT(*) OVER () " +
|
", COUNT(*) OVER () " +
|
||||||
"FROM projections.project_members2 AS members " +
|
"FROM projections.project_members2 AS members " +
|
||||||
"LEFT JOIN projections.users4_humans " +
|
"LEFT JOIN projections.users5_humans " +
|
||||||
"ON members.user_id = projections.users4_humans.user_id " +
|
"ON members.user_id = projections.users5_humans.user_id " +
|
||||||
"AND members.instance_id = projections.users4_humans.instance_id " +
|
"AND members.instance_id = projections.users5_humans.instance_id " +
|
||||||
"LEFT JOIN projections.users4_machines " +
|
"LEFT JOIN projections.users5_machines " +
|
||||||
"ON members.user_id = projections.users4_machines.user_id " +
|
"ON members.user_id = projections.users5_machines.user_id " +
|
||||||
"AND members.instance_id = projections.users4_machines.instance_id " +
|
"AND members.instance_id = projections.users5_machines.instance_id " +
|
||||||
"LEFT JOIN projections.login_names " +
|
"LEFT JOIN projections.login_names " +
|
||||||
"ON members.user_id = projections.login_names.user_id " +
|
"ON members.user_id = projections.login_names.user_id " +
|
||||||
"AND members.instance_id = projections.login_names.instance_id " +
|
"AND members.instance_id = projections.login_names.instance_id " +
|
||||||
|
@ -18,7 +18,7 @@ type userProjection struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
UserTable = "projections.users4"
|
UserTable = "projections.users5"
|
||||||
UserHumanTable = UserTable + "_" + UserHumanSuffix
|
UserHumanTable = UserTable + "_" + UserHumanSuffix
|
||||||
UserMachineTable = UserTable + "_" + UserMachineSuffix
|
UserMachineTable = UserTable + "_" + UserMachineSuffix
|
||||||
UserNotifyTable = UserTable + "_" + UserNotifySuffix
|
UserNotifyTable = UserTable + "_" + UserNotifySuffix
|
||||||
@ -89,9 +89,8 @@ func newUserProjection(ctx context.Context, config crdb.StatementHandlerConfig)
|
|||||||
crdb.NewColumn(UserTypeCol, crdb.ColumnTypeEnum),
|
crdb.NewColumn(UserTypeCol, crdb.ColumnTypeEnum),
|
||||||
},
|
},
|
||||||
crdb.NewPrimaryKey(UserIDCol, UserInstanceIDCol),
|
crdb.NewPrimaryKey(UserIDCol, UserInstanceIDCol),
|
||||||
crdb.WithIndex(crdb.NewIndex("username_idx4", []string{UserUsernameCol})),
|
crdb.WithIndex(crdb.NewIndex("username_idx5", []string{UserUsernameCol})),
|
||||||
crdb.WithIndex(crdb.NewIndex("user_ro_idx4", []string{UserResourceOwnerCol})),
|
crdb.WithIndex(crdb.NewIndex("user_ro_idx5", []string{UserResourceOwnerCol})),
|
||||||
crdb.WithConstraint(crdb.NewConstraint("user_id_unique4", []string{UserIDCol})),
|
|
||||||
),
|
),
|
||||||
crdb.NewSuffixedTable([]*crdb.Column{
|
crdb.NewSuffixedTable([]*crdb.Column{
|
||||||
crdb.NewColumn(HumanUserIDCol, crdb.ColumnTypeText),
|
crdb.NewColumn(HumanUserIDCol, crdb.ColumnTypeText),
|
||||||
@ -110,7 +109,7 @@ func newUserProjection(ctx context.Context, config crdb.StatementHandlerConfig)
|
|||||||
},
|
},
|
||||||
crdb.NewPrimaryKey(HumanUserIDCol, HumanUserInstanceIDCol),
|
crdb.NewPrimaryKey(HumanUserIDCol, HumanUserInstanceIDCol),
|
||||||
UserHumanSuffix,
|
UserHumanSuffix,
|
||||||
crdb.WithForeignKey(crdb.NewForeignKeyOfPublicKeys("fk_human_ref_user4")),
|
crdb.WithForeignKey(crdb.NewForeignKeyOfPublicKeys("fk_human_ref_user5")),
|
||||||
),
|
),
|
||||||
crdb.NewSuffixedTable([]*crdb.Column{
|
crdb.NewSuffixedTable([]*crdb.Column{
|
||||||
crdb.NewColumn(MachineUserIDCol, crdb.ColumnTypeText),
|
crdb.NewColumn(MachineUserIDCol, crdb.ColumnTypeText),
|
||||||
@ -120,7 +119,7 @@ func newUserProjection(ctx context.Context, config crdb.StatementHandlerConfig)
|
|||||||
},
|
},
|
||||||
crdb.NewPrimaryKey(MachineUserIDCol, MachineUserInstanceIDCol),
|
crdb.NewPrimaryKey(MachineUserIDCol, MachineUserInstanceIDCol),
|
||||||
UserMachineSuffix,
|
UserMachineSuffix,
|
||||||
crdb.WithForeignKey(crdb.NewForeignKeyOfPublicKeys("fk_machine_ref_user4")),
|
crdb.WithForeignKey(crdb.NewForeignKeyOfPublicKeys("fk_machine_ref_user5")),
|
||||||
),
|
),
|
||||||
crdb.NewSuffixedTable([]*crdb.Column{
|
crdb.NewSuffixedTable([]*crdb.Column{
|
||||||
crdb.NewColumn(NotifyUserIDCol, crdb.ColumnTypeText),
|
crdb.NewColumn(NotifyUserIDCol, crdb.ColumnTypeText),
|
||||||
@ -133,7 +132,7 @@ func newUserProjection(ctx context.Context, config crdb.StatementHandlerConfig)
|
|||||||
},
|
},
|
||||||
crdb.NewPrimaryKey(NotifyUserIDCol, NotifyInstanceIDCol),
|
crdb.NewPrimaryKey(NotifyUserIDCol, NotifyInstanceIDCol),
|
||||||
UserNotifySuffix,
|
UserNotifySuffix,
|
||||||
crdb.WithForeignKey(crdb.NewForeignKeyOfPublicKeys("fk_notify_ref_user4")),
|
crdb.WithForeignKey(crdb.NewForeignKeyOfPublicKeys("fk_notify_ref_user5")),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
p.StatementHandler = crdb.NewStatementHandler(ctx, config)
|
p.StatementHandler = crdb.NewStatementHandler(ctx, config)
|
||||||
|
@ -50,7 +50,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users4 (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.users5 (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.users4_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.users5_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.users4_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
|
expectedStmt: "INSERT INTO projections.users5_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.users4 (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.users5 (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.users4_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.users5_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.users4_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
|
expectedStmt: "INSERT INTO projections.users5_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.users4 (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.users5 (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.users4_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.users5_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.users4_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
|
expectedStmt: "INSERT INTO projections.users5_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.users4 (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.users5 (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.users4_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.users5_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.users4_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
|
expectedStmt: "INSERT INTO projections.users5_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.users4 (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.users5 (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.users4_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.users5_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.users4_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
|
expectedStmt: "INSERT INTO projections.users5_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.users4 (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.users5 (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.users4_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.users5_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.users4_notifications (user_id, instance_id, last_email, last_phone, password_set) VALUES ($1, $2, $3, $4, $5)",
|
expectedStmt: "INSERT INTO projections.users5_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.users4 SET state = $1 WHERE (id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users5 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.users4 SET state = $1 WHERE (id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users5 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.users4 SET state = $1 WHERE (id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users5 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.users4 SET state = $1 WHERE (id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users5 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.users4 SET (change_date, state, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
expectedStmt: "UPDATE projections.users5 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.users4 SET (change_date, state, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
expectedStmt: "UPDATE projections.users5 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.users4 SET (change_date, state, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
expectedStmt: "UPDATE projections.users5 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.users4 SET (change_date, state, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
expectedStmt: "UPDATE projections.users5 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.users4 WHERE (id = $1) AND (instance_id = $2)",
|
expectedStmt: "DELETE FROM projections.users5 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.users4 SET (change_date, username, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
expectedStmt: "UPDATE projections.users5 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.users4 SET (change_date, username, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
expectedStmt: "UPDATE projections.users5 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.users4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5 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.users4_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.users5_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.users4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5 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.users4_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.users5_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.users4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5 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.users4_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"+41 00 000 00 00",
|
"+41 00 000 00 00",
|
||||||
false,
|
false,
|
||||||
@ -885,7 +885,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users4_notifications SET last_phone = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users5_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.users4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5 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.users4_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"+41 00 000 00 00",
|
"+41 00 000 00 00",
|
||||||
false,
|
false,
|
||||||
@ -933,7 +933,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users4_notifications SET last_phone = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users5_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.users4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5 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.users4_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5_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.users4_notifications SET (last_phone, verified_phone) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5_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.users4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5 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.users4_humans SET (phone, is_phone_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5_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.users4_notifications SET (last_phone, verified_phone) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5_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.users4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5 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.users4_humans SET is_phone_verified = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users5_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.users4_notifications SET verified_phone = last_phone WHERE (user_id = $1) AND (instance_id = $2)",
|
expectedStmt: "UPDATE projections.users5_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.users4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5 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.users4_humans SET is_phone_verified = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users5_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.users4_notifications SET verified_phone = last_phone WHERE (user_id = $1) AND (instance_id = $2)",
|
expectedStmt: "UPDATE projections.users5_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.users4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5 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.users4_humans SET (email, is_email_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5_humans SET (email, is_email_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"email@zitadel.com",
|
"email@zitadel.com",
|
||||||
false,
|
false,
|
||||||
@ -1163,7 +1163,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users4_notifications SET last_email = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users5_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.users4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5 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.users4_humans SET (email, is_email_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5_humans SET (email, is_email_verified) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"email@zitadel.com",
|
"email@zitadel.com",
|
||||||
false,
|
false,
|
||||||
@ -1211,7 +1211,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users4_notifications SET last_email = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users5_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.users4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5 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.users4_humans SET is_email_verified = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users5_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.users4_notifications SET verified_email = last_email WHERE (user_id = $1) AND (instance_id = $2)",
|
expectedStmt: "UPDATE projections.users5_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.users4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5 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.users4_humans SET is_email_verified = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users5_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.users4_notifications SET verified_email = last_email WHERE (user_id = $1) AND (instance_id = $2)",
|
expectedStmt: "UPDATE projections.users5_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.users4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5 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.users4_humans SET avatar_key = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users5_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.users4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5 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.users4_humans SET avatar_key = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users5_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.users4 (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.users5 (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.users4_machines (user_id, instance_id, name, description) VALUES ($1, $2, $3, $4)",
|
expectedStmt: "INSERT INTO projections.users5_machines (user_id, instance_id, name, description) VALUES ($1, $2, $3, $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -1453,7 +1453,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users4 (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.users5 (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{},
|
||||||
@ -1467,7 +1467,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.users4_machines (user_id, instance_id, name, description) VALUES ($1, $2, $3, $4)",
|
expectedStmt: "INSERT INTO projections.users5_machines (user_id, instance_id, name, description) VALUES ($1, $2, $3, $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -1499,7 +1499,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -1508,7 +1508,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users4_machines SET (name, description) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5_machines SET (name, description) = ($1, $2) WHERE (user_id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"machine-name",
|
"machine-name",
|
||||||
"description",
|
"description",
|
||||||
@ -1539,7 +1539,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -1548,7 +1548,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users4_machines SET name = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users5_machines SET name = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"machine-name",
|
"machine-name",
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -1578,7 +1578,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users4 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.users5 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -1587,7 +1587,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.users4_machines SET description = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.users5_machines SET description = $1 WHERE (user_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"description",
|
"description",
|
||||||
"agg-id",
|
"agg-id",
|
||||||
@ -1634,7 +1634,7 @@ func TestUserProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "DELETE FROM projections.users4 WHERE (instance_id = $1)",
|
expectedStmt: "DELETE FROM projections.users5 WHERE (instance_id = $1)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
},
|
},
|
||||||
|
@ -511,6 +511,9 @@ func (c Column) isZero() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func join(join, from Column) string {
|
func join(join, from Column) string {
|
||||||
|
if join.identifier() == join.table.InstanceIDIdentifier() {
|
||||||
|
return join.table.identifier() + " ON " + from.identifier() + " = " + join.identifier()
|
||||||
|
}
|
||||||
return join.table.identifier() + " ON " + from.identifier() + " = " + join.identifier() + " AND " + from.table.InstanceIDIdentifier() + " = " + join.table.InstanceIDIdentifier()
|
return join.table.identifier() + " ON " + from.identifier() + " = " + join.identifier() + " AND " + from.table.InstanceIDIdentifier() + " = " + join.table.InstanceIDIdentifier()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,14 +302,13 @@ func (q *Queries) GetUserByID(ctx context.Context, shouldTriggerBulk bool, userI
|
|||||||
projection.LoginNameProjection.Trigger(ctx)
|
projection.LoginNameProjection.Trigger(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
instanceID := authz.GetInstance(ctx).InstanceID()
|
query, scan := prepareUserQuery()
|
||||||
query, scan := prepareUserQuery(instanceID)
|
|
||||||
for _, q := range queries {
|
for _, q := range queries {
|
||||||
query = q.toQuery(query)
|
query = q.toQuery(query)
|
||||||
}
|
}
|
||||||
stmt, args, err := query.Where(sq.Eq{
|
stmt, args, err := query.Where(sq.Eq{
|
||||||
UserIDCol.identifier(): userID,
|
UserIDCol.identifier(): userID,
|
||||||
UserInstanceIDCol.identifier(): instanceID,
|
UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID(),
|
||||||
}).ToSql()
|
}).ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.ThrowInternal(err, "QUERY-FBg21", "Errors.Query.SQLStatment")
|
return nil, errors.ThrowInternal(err, "QUERY-FBg21", "Errors.Query.SQLStatment")
|
||||||
@ -325,13 +324,12 @@ func (q *Queries) GetUser(ctx context.Context, shouldTriggerBulk bool, queries .
|
|||||||
projection.LoginNameProjection.Trigger(ctx)
|
projection.LoginNameProjection.Trigger(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
instanceID := authz.GetInstance(ctx).InstanceID()
|
query, scan := prepareUserQuery()
|
||||||
query, scan := prepareUserQuery(instanceID)
|
|
||||||
for _, q := range queries {
|
for _, q := range queries {
|
||||||
query = q.toQuery(query)
|
query = q.toQuery(query)
|
||||||
}
|
}
|
||||||
stmt, args, err := query.Where(sq.Eq{
|
stmt, args, err := query.Where(sq.Eq{
|
||||||
UserInstanceIDCol.identifier(): instanceID,
|
UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID(),
|
||||||
}).ToSql()
|
}).ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.ThrowInternal(err, "QUERY-Dnhr2", "Errors.Query.SQLStatment")
|
return nil, errors.ThrowInternal(err, "QUERY-Dnhr2", "Errors.Query.SQLStatment")
|
||||||
@ -398,14 +396,13 @@ func (q *Queries) GetNotifyUserByID(ctx context.Context, shouldTriggered bool, u
|
|||||||
projection.LoginNameProjection.Trigger(ctx)
|
projection.LoginNameProjection.Trigger(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
instanceID := authz.GetInstance(ctx).InstanceID()
|
query, scan := prepareNotifyUserQuery()
|
||||||
query, scan := prepareNotifyUserQuery(instanceID)
|
|
||||||
for _, q := range queries {
|
for _, q := range queries {
|
||||||
query = q.toQuery(query)
|
query = q.toQuery(query)
|
||||||
}
|
}
|
||||||
stmt, args, err := query.Where(sq.Eq{
|
stmt, args, err := query.Where(sq.Eq{
|
||||||
UserIDCol.identifier(): userID,
|
UserIDCol.identifier(): userID,
|
||||||
UserInstanceIDCol.identifier(): instanceID,
|
UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID(),
|
||||||
}).ToSql()
|
}).ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.ThrowInternal(err, "QUERY-Err3g", "Errors.Query.SQLStatment")
|
return nil, errors.ThrowInternal(err, "QUERY-Err3g", "Errors.Query.SQLStatment")
|
||||||
@ -421,13 +418,12 @@ func (q *Queries) GetNotifyUser(ctx context.Context, shouldTriggered bool, queri
|
|||||||
projection.LoginNameProjection.Trigger(ctx)
|
projection.LoginNameProjection.Trigger(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
instanceID := authz.GetInstance(ctx).InstanceID()
|
query, scan := prepareNotifyUserQuery()
|
||||||
query, scan := prepareNotifyUserQuery(instanceID)
|
|
||||||
for _, q := range queries {
|
for _, q := range queries {
|
||||||
query = q.toQuery(query)
|
query = q.toQuery(query)
|
||||||
}
|
}
|
||||||
stmt, args, err := query.Where(sq.Eq{
|
stmt, args, err := query.Where(sq.Eq{
|
||||||
UserInstanceIDCol.identifier(): instanceID,
|
UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID(),
|
||||||
}).ToSql()
|
}).ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.ThrowInternal(err, "QUERY-Err3g", "Errors.Query.SQLStatment")
|
return nil, errors.ThrowInternal(err, "QUERY-Err3g", "Errors.Query.SQLStatment")
|
||||||
@ -442,7 +438,8 @@ func (q *Queries) SearchUsers(ctx context.Context, queries *UserSearchQueries) (
|
|||||||
stmt, args, err := queries.toQuery(query).
|
stmt, args, err := queries.toQuery(query).
|
||||||
Where(sq.Eq{
|
Where(sq.Eq{
|
||||||
UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID(),
|
UserInstanceIDCol.identifier(): authz.GetInstance(ctx).InstanceID(),
|
||||||
}).ToSql()
|
}).
|
||||||
|
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")
|
||||||
}
|
}
|
||||||
@ -597,26 +594,27 @@ func NewUserLoginNameExistsQuery(value string, comparison TextComparison) (Searc
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func prepareUserQuery(instanceID string) (sq.SelectBuilder, func(*sql.Row) (*User, error)) {
|
func prepareUserQuery() (sq.SelectBuilder, func(*sql.Row) (*User, error)) {
|
||||||
loginNamesQuery, loginNamesArgs, err := sq.Select(
|
loginNamesQuery, _, err := sq.Select(
|
||||||
userLoginNamesUserIDCol.identifier(),
|
userLoginNamesUserIDCol.identifier(),
|
||||||
"ARRAY_AGG("+userLoginNamesNameCol.identifier()+")::TEXT[] AS "+userLoginNamesListCol.name).
|
"ARRAY_AGG("+userLoginNamesNameCol.identifier()+") AS "+userLoginNamesListCol.name,
|
||||||
|
userLoginNamesInstanceIDCol.identifier()).
|
||||||
From(userLoginNamesTable.identifier()).
|
From(userLoginNamesTable.identifier()).
|
||||||
GroupBy(userLoginNamesUserIDCol.identifier()).
|
GroupBy(userLoginNamesUserIDCol.identifier(), userLoginNamesInstanceIDCol.identifier()).
|
||||||
Where(sq.Eq{
|
ToSql()
|
||||||
userLoginNamesInstanceIDCol.identifier(): instanceID,
|
|
||||||
}).ToSql()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return sq.SelectBuilder{}, nil
|
return sq.SelectBuilder{}, nil
|
||||||
}
|
}
|
||||||
preferredLoginNameQuery, preferredLoginNameArgs, err := sq.Select(
|
preferredLoginNameQuery, preferredLoginNameArgs, err := sq.Select(
|
||||||
userPreferredLoginNameUserIDCol.identifier(),
|
userPreferredLoginNameUserIDCol.identifier(),
|
||||||
userPreferredLoginNameCol.identifier()).
|
userPreferredLoginNameCol.identifier(),
|
||||||
|
userPreferredLoginNameInstanceIDCol.identifier()).
|
||||||
From(userPreferredLoginNameTable.identifier()).
|
From(userPreferredLoginNameTable.identifier()).
|
||||||
Where(sq.Eq{
|
Where(
|
||||||
userPreferredLoginNameIsPrimaryCol.identifier(): true,
|
sq.Eq{
|
||||||
userPreferredLoginNameInstanceIDCol.identifier(): instanceID,
|
userPreferredLoginNameIsPrimaryCol.identifier(): true,
|
||||||
}).ToSql()
|
}).
|
||||||
|
ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return sq.SelectBuilder{}, nil
|
return sq.SelectBuilder{}, nil
|
||||||
}
|
}
|
||||||
@ -651,8 +649,13 @@ func prepareUserQuery(instanceID string) (sq.SelectBuilder, func(*sql.Row) (*Use
|
|||||||
From(userTable.identifier()).
|
From(userTable.identifier()).
|
||||||
LeftJoin(join(HumanUserIDCol, UserIDCol)).
|
LeftJoin(join(HumanUserIDCol, UserIDCol)).
|
||||||
LeftJoin(join(MachineUserIDCol, UserIDCol)).
|
LeftJoin(join(MachineUserIDCol, UserIDCol)).
|
||||||
LeftJoin("("+loginNamesQuery+") AS "+userLoginNamesTable.alias+" ON "+userLoginNamesUserIDCol.identifier()+" = "+UserIDCol.identifier(), loginNamesArgs...).
|
LeftJoin("("+loginNamesQuery+") AS "+userLoginNamesTable.alias+" ON "+
|
||||||
LeftJoin("("+preferredLoginNameQuery+") AS "+userPreferredLoginNameTable.alias+" ON "+userPreferredLoginNameUserIDCol.identifier()+" = "+UserIDCol.identifier(), preferredLoginNameArgs...).
|
userLoginNamesUserIDCol.identifier()+" = "+UserIDCol.identifier()+" AND "+
|
||||||
|
userLoginNamesInstanceIDCol.identifier()+" = "+UserInstanceIDCol.identifier()).
|
||||||
|
LeftJoin("("+preferredLoginNameQuery+") AS "+userPreferredLoginNameTable.alias+" ON "+
|
||||||
|
userPreferredLoginNameUserIDCol.identifier()+" = "+UserIDCol.identifier()+" AND "+
|
||||||
|
userPreferredLoginNameInstanceIDCol.identifier()+" = "+UserInstanceIDCol.identifier(),
|
||||||
|
preferredLoginNameArgs...).
|
||||||
PlaceholderFormat(sq.Dollar),
|
PlaceholderFormat(sq.Dollar),
|
||||||
func(row *sql.Row) (*User, error) {
|
func(row *sql.Row) (*User, error) {
|
||||||
u := new(User)
|
u := new(User)
|
||||||
@ -898,26 +901,27 @@ func preparePhoneQuery() (sq.SelectBuilder, func(*sql.Row) (*Phone, error)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func prepareNotifyUserQuery(instanceID string) (sq.SelectBuilder, func(*sql.Row) (*NotifyUser, error)) {
|
func prepareNotifyUserQuery() (sq.SelectBuilder, func(*sql.Row) (*NotifyUser, error)) {
|
||||||
loginNamesQuery, loginNamesArgs, err := sq.Select(
|
loginNamesQuery, _, err := sq.Select(
|
||||||
userLoginNamesUserIDCol.identifier(),
|
userLoginNamesUserIDCol.identifier(),
|
||||||
"ARRAY_AGG("+userLoginNamesNameCol.identifier()+") AS "+userLoginNamesListCol.name).
|
"ARRAY_AGG("+userLoginNamesNameCol.identifier()+") AS "+userLoginNamesListCol.name,
|
||||||
|
userLoginNamesInstanceIDCol.identifier()).
|
||||||
From(userLoginNamesTable.identifier()).
|
From(userLoginNamesTable.identifier()).
|
||||||
GroupBy(userLoginNamesUserIDCol.identifier()).
|
GroupBy(userLoginNamesUserIDCol.identifier(), userLoginNamesInstanceIDCol.identifier()).
|
||||||
Where(sq.Eq{
|
ToSql()
|
||||||
userLoginNamesInstanceIDCol.identifier(): instanceID,
|
|
||||||
}).ToSql()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return sq.SelectBuilder{}, nil
|
return sq.SelectBuilder{}, nil
|
||||||
}
|
}
|
||||||
preferredLoginNameQuery, preferredLoginNameArgs, err := sq.Select(
|
preferredLoginNameQuery, preferredLoginNameArgs, err := sq.Select(
|
||||||
userPreferredLoginNameUserIDCol.identifier(),
|
userPreferredLoginNameUserIDCol.identifier(),
|
||||||
userPreferredLoginNameCol.identifier()).
|
userPreferredLoginNameCol.identifier(),
|
||||||
|
userPreferredLoginNameInstanceIDCol.identifier()).
|
||||||
From(userPreferredLoginNameTable.identifier()).
|
From(userPreferredLoginNameTable.identifier()).
|
||||||
Where(sq.Eq{
|
Where(
|
||||||
userPreferredLoginNameIsPrimaryCol.identifier(): true,
|
sq.Eq{
|
||||||
userPreferredLoginNameInstanceIDCol.identifier(): instanceID,
|
userPreferredLoginNameIsPrimaryCol.identifier(): true,
|
||||||
}).ToSql()
|
}).
|
||||||
|
ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return sq.SelectBuilder{}, nil
|
return sq.SelectBuilder{}, nil
|
||||||
}
|
}
|
||||||
@ -951,8 +955,13 @@ func prepareNotifyUserQuery(instanceID string) (sq.SelectBuilder, func(*sql.Row)
|
|||||||
From(userTable.identifier()).
|
From(userTable.identifier()).
|
||||||
LeftJoin(join(HumanUserIDCol, UserIDCol)).
|
LeftJoin(join(HumanUserIDCol, UserIDCol)).
|
||||||
LeftJoin(join(NotifyUserIDCol, UserIDCol)).
|
LeftJoin(join(NotifyUserIDCol, UserIDCol)).
|
||||||
LeftJoin("("+loginNamesQuery+") AS "+userLoginNamesTable.alias+" ON "+userLoginNamesUserIDCol.identifier()+" = "+UserIDCol.identifier(), loginNamesArgs...).
|
LeftJoin("("+loginNamesQuery+") AS "+userLoginNamesTable.alias+" ON "+
|
||||||
LeftJoin("("+preferredLoginNameQuery+") AS "+userPreferredLoginNameTable.alias+" ON "+userPreferredLoginNameUserIDCol.identifier()+" = "+UserIDCol.identifier(), preferredLoginNameArgs...).
|
userLoginNamesUserIDCol.identifier()+" = "+UserIDCol.identifier()+" AND "+
|
||||||
|
userLoginNamesInstanceIDCol.identifier()+" = "+UserInstanceIDCol.identifier()).
|
||||||
|
LeftJoin("("+preferredLoginNameQuery+") AS "+userPreferredLoginNameTable.alias+" ON "+
|
||||||
|
userPreferredLoginNameUserIDCol.identifier()+" = "+UserIDCol.identifier()+" AND "+
|
||||||
|
userPreferredLoginNameInstanceIDCol.identifier()+" = "+UserInstanceIDCol.identifier(),
|
||||||
|
preferredLoginNameArgs...).
|
||||||
PlaceholderFormat(sq.Dollar),
|
PlaceholderFormat(sq.Dollar),
|
||||||
func(row *sql.Row) (*NotifyUser, error) {
|
func(row *sql.Row) (*NotifyUser, error) {
|
||||||
u := new(NotifyUser)
|
u := new(NotifyUser)
|
||||||
@ -1078,21 +1087,24 @@ func prepareUserUniqueQuery() (sq.SelectBuilder, func(*sql.Row) (bool, error)) {
|
|||||||
func prepareUsersQuery() (sq.SelectBuilder, func(*sql.Rows) (*Users, error)) {
|
func prepareUsersQuery() (sq.SelectBuilder, func(*sql.Rows) (*Users, error)) {
|
||||||
loginNamesQuery, _, err := sq.Select(
|
loginNamesQuery, _, err := sq.Select(
|
||||||
userLoginNamesUserIDCol.identifier(),
|
userLoginNamesUserIDCol.identifier(),
|
||||||
"ARRAY_AGG("+userLoginNamesNameCol.identifier()+") AS "+userLoginNamesListCol.name).
|
"ARRAY_AGG("+userLoginNamesNameCol.identifier()+") AS "+userLoginNamesListCol.name,
|
||||||
|
userLoginNamesInstanceIDCol.identifier()).
|
||||||
From(userLoginNamesTable.identifier()).
|
From(userLoginNamesTable.identifier()).
|
||||||
GroupBy(userLoginNamesUserIDCol.identifier()).
|
GroupBy(userLoginNamesUserIDCol.identifier(), userLoginNamesInstanceIDCol.identifier()).
|
||||||
ToSql()
|
ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return sq.SelectBuilder{}, nil
|
return sq.SelectBuilder{}, nil
|
||||||
}
|
}
|
||||||
preferredLoginNameQuery, preferredLoginNameArgs, err := sq.Select(
|
preferredLoginNameQuery, preferredLoginNameArgs, err := sq.Select(
|
||||||
userPreferredLoginNameUserIDCol.identifier(),
|
userPreferredLoginNameUserIDCol.identifier(),
|
||||||
userPreferredLoginNameCol.identifier()).
|
userPreferredLoginNameCol.identifier(),
|
||||||
|
userPreferredLoginNameInstanceIDCol.identifier()).
|
||||||
From(userPreferredLoginNameTable.identifier()).
|
From(userPreferredLoginNameTable.identifier()).
|
||||||
Where(
|
Where(
|
||||||
sq.Eq{
|
sq.Eq{
|
||||||
userPreferredLoginNameIsPrimaryCol.identifier(): true,
|
userPreferredLoginNameIsPrimaryCol.identifier(): true,
|
||||||
}).ToSql()
|
}).
|
||||||
|
ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return sq.SelectBuilder{}, nil
|
return sq.SelectBuilder{}, nil
|
||||||
}
|
}
|
||||||
@ -1126,8 +1138,13 @@ func prepareUsersQuery() (sq.SelectBuilder, func(*sql.Rows) (*Users, error)) {
|
|||||||
From(userTable.identifier()).
|
From(userTable.identifier()).
|
||||||
LeftJoin(join(HumanUserIDCol, UserIDCol)).
|
LeftJoin(join(HumanUserIDCol, UserIDCol)).
|
||||||
LeftJoin(join(MachineUserIDCol, UserIDCol)).
|
LeftJoin(join(MachineUserIDCol, UserIDCol)).
|
||||||
LeftJoin("("+loginNamesQuery+") AS "+userLoginNamesTable.alias+" ON "+userLoginNamesUserIDCol.identifier()+" = "+UserIDCol.identifier()).
|
LeftJoin("("+loginNamesQuery+") AS "+userLoginNamesTable.alias+" ON "+
|
||||||
LeftJoin("("+preferredLoginNameQuery+") AS "+userPreferredLoginNameTable.alias+" ON "+userPreferredLoginNameUserIDCol.identifier()+" = "+UserIDCol.identifier(), preferredLoginNameArgs...).
|
userLoginNamesUserIDCol.identifier()+" = "+UserIDCol.identifier()+" AND "+
|
||||||
|
userLoginNamesInstanceIDCol.identifier()+" = "+UserInstanceIDCol.identifier()).
|
||||||
|
LeftJoin("("+preferredLoginNameQuery+") AS "+userPreferredLoginNameTable.alias+" ON "+
|
||||||
|
userPreferredLoginNameUserIDCol.identifier()+" = "+UserIDCol.identifier()+" AND "+
|
||||||
|
userPreferredLoginNameInstanceIDCol.identifier()+" = "+UserInstanceIDCol.identifier(),
|
||||||
|
preferredLoginNameArgs...).
|
||||||
PlaceholderFormat(sq.Dollar),
|
PlaceholderFormat(sq.Dollar),
|
||||||
func(rows *sql.Rows) (*Users, error) {
|
func(rows *sql.Rows) (*Users, error) {
|
||||||
users := make([]*User, 0)
|
users := make([]*User, 0)
|
||||||
|
@ -23,14 +23,14 @@ var (
|
|||||||
", projections.user_grants2.roles" +
|
", projections.user_grants2.roles" +
|
||||||
", projections.user_grants2.state" +
|
", projections.user_grants2.state" +
|
||||||
", projections.user_grants2.user_id" +
|
", projections.user_grants2.user_id" +
|
||||||
", projections.users4.username" +
|
", projections.users5.username" +
|
||||||
", projections.users4.type" +
|
", projections.users5.type" +
|
||||||
", projections.users4.resource_owner" +
|
", projections.users5.resource_owner" +
|
||||||
", projections.users4_humans.first_name" +
|
", projections.users5_humans.first_name" +
|
||||||
", projections.users4_humans.last_name" +
|
", projections.users5_humans.last_name" +
|
||||||
", projections.users4_humans.email" +
|
", projections.users5_humans.email" +
|
||||||
", projections.users4_humans.display_name" +
|
", projections.users5_humans.display_name" +
|
||||||
", projections.users4_humans.avatar_key" +
|
", projections.users5_humans.avatar_key" +
|
||||||
", projections.login_names.login_name" +
|
", projections.login_names.login_name" +
|
||||||
", projections.user_grants2.resource_owner" +
|
", projections.user_grants2.resource_owner" +
|
||||||
", projections.orgs.name" +
|
", projections.orgs.name" +
|
||||||
@ -38,8 +38,8 @@ var (
|
|||||||
", projections.user_grants2.project_id" +
|
", projections.user_grants2.project_id" +
|
||||||
", projections.projects2.name" +
|
", projections.projects2.name" +
|
||||||
" FROM projections.user_grants2" +
|
" FROM projections.user_grants2" +
|
||||||
" LEFT JOIN projections.users4 ON projections.user_grants2.user_id = projections.users4.id AND projections.user_grants2.instance_id = projections.users4.instance_id" +
|
" LEFT JOIN projections.users5 ON projections.user_grants2.user_id = projections.users5.id AND projections.user_grants2.instance_id = projections.users5.instance_id" +
|
||||||
" LEFT JOIN projections.users4_humans ON projections.user_grants2.user_id = projections.users4_humans.user_id AND projections.user_grants2.instance_id = projections.users4_humans.instance_id" +
|
" LEFT JOIN projections.users5_humans ON projections.user_grants2.user_id = projections.users5_humans.user_id AND projections.user_grants2.instance_id = projections.users5_humans.instance_id" +
|
||||||
" LEFT JOIN projections.orgs ON projections.user_grants2.resource_owner = projections.orgs.id AND projections.user_grants2.instance_id = projections.orgs.instance_id" +
|
" LEFT JOIN projections.orgs ON projections.user_grants2.resource_owner = projections.orgs.id AND projections.user_grants2.instance_id = projections.orgs.instance_id" +
|
||||||
" LEFT JOIN projections.projects2 ON projections.user_grants2.project_id = projections.projects2.id AND projections.user_grants2.instance_id = projections.projects2.instance_id" +
|
" LEFT JOIN projections.projects2 ON projections.user_grants2.project_id = projections.projects2.id AND projections.user_grants2.instance_id = projections.projects2.instance_id" +
|
||||||
" LEFT JOIN projections.login_names ON projections.user_grants2.user_id = projections.login_names.user_id AND projections.user_grants2.instance_id = projections.login_names.instance_id" +
|
" LEFT JOIN projections.login_names ON projections.user_grants2.user_id = projections.login_names.user_id AND projections.user_grants2.instance_id = projections.login_names.instance_id" +
|
||||||
@ -77,14 +77,14 @@ var (
|
|||||||
", projections.user_grants2.roles" +
|
", projections.user_grants2.roles" +
|
||||||
", projections.user_grants2.state" +
|
", projections.user_grants2.state" +
|
||||||
", projections.user_grants2.user_id" +
|
", projections.user_grants2.user_id" +
|
||||||
", projections.users4.username" +
|
", projections.users5.username" +
|
||||||
", projections.users4.type" +
|
", projections.users5.type" +
|
||||||
", projections.users4.resource_owner" +
|
", projections.users5.resource_owner" +
|
||||||
", projections.users4_humans.first_name" +
|
", projections.users5_humans.first_name" +
|
||||||
", projections.users4_humans.last_name" +
|
", projections.users5_humans.last_name" +
|
||||||
", projections.users4_humans.email" +
|
", projections.users5_humans.email" +
|
||||||
", projections.users4_humans.display_name" +
|
", projections.users5_humans.display_name" +
|
||||||
", projections.users4_humans.avatar_key" +
|
", projections.users5_humans.avatar_key" +
|
||||||
", projections.login_names.login_name" +
|
", projections.login_names.login_name" +
|
||||||
", projections.user_grants2.resource_owner" +
|
", projections.user_grants2.resource_owner" +
|
||||||
", projections.orgs.name" +
|
", projections.orgs.name" +
|
||||||
@ -93,8 +93,8 @@ var (
|
|||||||
", projections.projects2.name" +
|
", projections.projects2.name" +
|
||||||
", COUNT(*) OVER ()" +
|
", COUNT(*) OVER ()" +
|
||||||
" FROM projections.user_grants2" +
|
" FROM projections.user_grants2" +
|
||||||
" LEFT JOIN projections.users4 ON projections.user_grants2.user_id = projections.users4.id AND projections.user_grants2.instance_id = projections.users4.instance_id" +
|
" LEFT JOIN projections.users5 ON projections.user_grants2.user_id = projections.users5.id AND projections.user_grants2.instance_id = projections.users5.instance_id" +
|
||||||
" LEFT JOIN projections.users4_humans ON projections.user_grants2.user_id = projections.users4_humans.user_id AND projections.user_grants2.instance_id = projections.users4_humans.instance_id" +
|
" LEFT JOIN projections.users5_humans ON projections.user_grants2.user_id = projections.users5_humans.user_id AND projections.user_grants2.instance_id = projections.users5_humans.instance_id" +
|
||||||
" LEFT JOIN projections.orgs ON projections.user_grants2.resource_owner = projections.orgs.id AND projections.user_grants2.instance_id = projections.orgs.instance_id" +
|
" LEFT JOIN projections.orgs ON projections.user_grants2.resource_owner = projections.orgs.id AND projections.user_grants2.instance_id = projections.orgs.instance_id" +
|
||||||
" LEFT JOIN projections.projects2 ON projections.user_grants2.project_id = projections.projects2.id AND projections.user_grants2.instance_id = projections.projects2.instance_id" +
|
" LEFT JOIN projections.projects2 ON projections.user_grants2.project_id = projections.projects2.id AND projections.user_grants2.instance_id = projections.projects2.instance_id" +
|
||||||
" LEFT JOIN projections.login_names ON projections.user_grants2.user_id = projections.login_names.user_id AND projections.user_grants2.instance_id = projections.login_names.instance_id" +
|
" LEFT JOIN projections.login_names ON projections.user_grants2.user_id = projections.login_names.user_id AND projections.user_grants2.instance_id = projections.login_names.instance_id" +
|
||||||
|
@ -17,44 +17,45 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
userQuery = `SELECT projections.users4.id,` +
|
userQuery = `SELECT projections.users5.id,` +
|
||||||
` projections.users4.creation_date,` +
|
` projections.users5.creation_date,` +
|
||||||
` projections.users4.change_date,` +
|
` projections.users5.change_date,` +
|
||||||
` projections.users4.resource_owner,` +
|
` projections.users5.resource_owner,` +
|
||||||
` projections.users4.sequence,` +
|
` projections.users5.sequence,` +
|
||||||
` projections.users4.state,` +
|
` projections.users5.state,` +
|
||||||
` projections.users4.type,` +
|
` projections.users5.type,` +
|
||||||
` projections.users4.username,` +
|
` projections.users5.username,` +
|
||||||
` login_names.loginnames,` +
|
` login_names.loginnames,` +
|
||||||
` preferred_login_name.login_name,` +
|
` preferred_login_name.login_name,` +
|
||||||
` projections.users4_humans.user_id,` +
|
` projections.users5_humans.user_id,` +
|
||||||
` projections.users4_humans.first_name,` +
|
` projections.users5_humans.first_name,` +
|
||||||
` projections.users4_humans.last_name,` +
|
` projections.users5_humans.last_name,` +
|
||||||
` projections.users4_humans.nick_name,` +
|
` projections.users5_humans.nick_name,` +
|
||||||
` projections.users4_humans.display_name,` +
|
` projections.users5_humans.display_name,` +
|
||||||
` projections.users4_humans.preferred_language,` +
|
` projections.users5_humans.preferred_language,` +
|
||||||
` projections.users4_humans.gender,` +
|
` projections.users5_humans.gender,` +
|
||||||
` projections.users4_humans.avatar_key,` +
|
` projections.users5_humans.avatar_key,` +
|
||||||
` projections.users4_humans.email,` +
|
` projections.users5_humans.email,` +
|
||||||
` projections.users4_humans.is_email_verified,` +
|
` projections.users5_humans.is_email_verified,` +
|
||||||
` projections.users4_humans.phone,` +
|
` projections.users5_humans.phone,` +
|
||||||
` projections.users4_humans.is_phone_verified,` +
|
` projections.users5_humans.is_phone_verified,` +
|
||||||
` projections.users4_machines.user_id,` +
|
` projections.users5_machines.user_id,` +
|
||||||
` projections.users4_machines.name,` +
|
` projections.users5_machines.name,` +
|
||||||
` projections.users4_machines.description,` +
|
` projections.users5_machines.description,` +
|
||||||
` COUNT(*) OVER ()` +
|
` COUNT(*) OVER ()` +
|
||||||
` FROM projections.users4` +
|
` FROM projections.users5` +
|
||||||
` LEFT JOIN projections.users4_humans ON projections.users4.id = projections.users4_humans.user_id AND projections.users4.instance_id = projections.users4_humans.instance_id` +
|
` LEFT JOIN projections.users5_humans ON projections.users5.id = projections.users5_humans.user_id AND projections.users5.instance_id = projections.users5_humans.instance_id` +
|
||||||
` LEFT JOIN projections.users4_machines ON projections.users4.id = projections.users4_machines.user_id AND projections.users4.instance_id = projections.users4_machines.instance_id` +
|
` LEFT JOIN projections.users5_machines ON projections.users5.id = projections.users5_machines.user_id AND projections.users5.instance_id = projections.users5_machines.instance_id` +
|
||||||
` LEFT JOIN` +
|
` LEFT JOIN` +
|
||||||
` (SELECT login_names.user_id, ARRAY_AGG(login_names.login_name)::TEXT[] AS loginnames` +
|
` (SELECT login_names.user_id, ARRAY_AGG(login_names.login_name) AS loginnames, login_names.instance_id` +
|
||||||
` FROM projections.login_names AS login_names` +
|
` FROM projections.login_names AS login_names` +
|
||||||
` WHERE login_names.instance_id = $1` +
|
` GROUP BY login_names.user_id, login_names.instance_id) AS login_names` +
|
||||||
` GROUP BY login_names.user_id) AS login_names` +
|
` ON login_names.user_id = projections.users5.id AND login_names.instance_id = projections.users5.instance_id` +
|
||||||
` ON login_names.user_id = projections.users4.id` +
|
|
||||||
` LEFT JOIN` +
|
` LEFT JOIN` +
|
||||||
` (SELECT preferred_login_name.user_id, preferred_login_name.login_name FROM projections.login_names AS preferred_login_name WHERE preferred_login_name.instance_id = $2 AND preferred_login_name.is_primary = $3) AS preferred_login_name` +
|
` (SELECT preferred_login_name.user_id, preferred_login_name.login_name, preferred_login_name.instance_id` +
|
||||||
` ON preferred_login_name.user_id = projections.users4.id`
|
` FROM projections.login_names AS preferred_login_name` +
|
||||||
|
` WHERE preferred_login_name.is_primary = $1) AS preferred_login_name` +
|
||||||
|
` ON preferred_login_name.user_id = projections.users5.id AND preferred_login_name.instance_id = projections.users5.instance_id`
|
||||||
userCols = []string{
|
userCols = []string{
|
||||||
"id",
|
"id",
|
||||||
"creation_date",
|
"creation_date",
|
||||||
@ -85,21 +86,21 @@ var (
|
|||||||
"description",
|
"description",
|
||||||
"count",
|
"count",
|
||||||
}
|
}
|
||||||
profileQuery = `SELECT projections.users4.id,` +
|
profileQuery = `SELECT projections.users5.id,` +
|
||||||
` projections.users4.creation_date,` +
|
` projections.users5.creation_date,` +
|
||||||
` projections.users4.change_date,` +
|
` projections.users5.change_date,` +
|
||||||
` projections.users4.resource_owner,` +
|
` projections.users5.resource_owner,` +
|
||||||
` projections.users4.sequence,` +
|
` projections.users5.sequence,` +
|
||||||
` projections.users4_humans.user_id,` +
|
` projections.users5_humans.user_id,` +
|
||||||
` projections.users4_humans.first_name,` +
|
` projections.users5_humans.first_name,` +
|
||||||
` projections.users4_humans.last_name,` +
|
` projections.users5_humans.last_name,` +
|
||||||
` projections.users4_humans.nick_name,` +
|
` projections.users5_humans.nick_name,` +
|
||||||
` projections.users4_humans.display_name,` +
|
` projections.users5_humans.display_name,` +
|
||||||
` projections.users4_humans.preferred_language,` +
|
` projections.users5_humans.preferred_language,` +
|
||||||
` projections.users4_humans.gender,` +
|
` projections.users5_humans.gender,` +
|
||||||
` projections.users4_humans.avatar_key` +
|
` projections.users5_humans.avatar_key` +
|
||||||
` FROM projections.users4` +
|
` FROM projections.users5` +
|
||||||
` LEFT JOIN projections.users4_humans ON projections.users4.id = projections.users4_humans.user_id AND projections.users4.instance_id = projections.users4_humans.instance_id`
|
` LEFT JOIN projections.users5_humans ON projections.users5.id = projections.users5_humans.user_id AND projections.users5.instance_id = projections.users5_humans.instance_id`
|
||||||
profileCols = []string{
|
profileCols = []string{
|
||||||
"id",
|
"id",
|
||||||
"creation_date",
|
"creation_date",
|
||||||
@ -115,16 +116,16 @@ var (
|
|||||||
"gender",
|
"gender",
|
||||||
"avatar_key",
|
"avatar_key",
|
||||||
}
|
}
|
||||||
emailQuery = `SELECT projections.users4.id,` +
|
emailQuery = `SELECT projections.users5.id,` +
|
||||||
` projections.users4.creation_date,` +
|
` projections.users5.creation_date,` +
|
||||||
` projections.users4.change_date,` +
|
` projections.users5.change_date,` +
|
||||||
` projections.users4.resource_owner,` +
|
` projections.users5.resource_owner,` +
|
||||||
` projections.users4.sequence,` +
|
` projections.users5.sequence,` +
|
||||||
` projections.users4_humans.user_id,` +
|
` projections.users5_humans.user_id,` +
|
||||||
` projections.users4_humans.email,` +
|
` projections.users5_humans.email,` +
|
||||||
` projections.users4_humans.is_email_verified` +
|
` projections.users5_humans.is_email_verified` +
|
||||||
` FROM projections.users4` +
|
` FROM projections.users5` +
|
||||||
` LEFT JOIN projections.users4_humans ON projections.users4.id = projections.users4_humans.user_id AND projections.users4.instance_id = projections.users4_humans.instance_id`
|
` LEFT JOIN projections.users5_humans ON projections.users5.id = projections.users5_humans.user_id AND projections.users5.instance_id = projections.users5_humans.instance_id`
|
||||||
emailCols = []string{
|
emailCols = []string{
|
||||||
"id",
|
"id",
|
||||||
"creation_date",
|
"creation_date",
|
||||||
@ -135,16 +136,16 @@ var (
|
|||||||
"email",
|
"email",
|
||||||
"is_email_verified",
|
"is_email_verified",
|
||||||
}
|
}
|
||||||
phoneQuery = `SELECT projections.users4.id,` +
|
phoneQuery = `SELECT projections.users5.id,` +
|
||||||
` projections.users4.creation_date,` +
|
` projections.users5.creation_date,` +
|
||||||
` projections.users4.change_date,` +
|
` projections.users5.change_date,` +
|
||||||
` projections.users4.resource_owner,` +
|
` projections.users5.resource_owner,` +
|
||||||
` projections.users4.sequence,` +
|
` projections.users5.sequence,` +
|
||||||
` projections.users4_humans.user_id,` +
|
` projections.users5_humans.user_id,` +
|
||||||
` projections.users4_humans.phone,` +
|
` projections.users5_humans.phone,` +
|
||||||
` projections.users4_humans.is_phone_verified` +
|
` projections.users5_humans.is_phone_verified` +
|
||||||
` FROM projections.users4` +
|
` FROM projections.users5` +
|
||||||
` LEFT JOIN projections.users4_humans ON projections.users4.id = projections.users4_humans.user_id AND projections.users4.instance_id = projections.users4_humans.instance_id`
|
` LEFT JOIN projections.users5_humans ON projections.users5.id = projections.users5_humans.user_id AND projections.users5.instance_id = projections.users5_humans.instance_id`
|
||||||
phoneCols = []string{
|
phoneCols = []string{
|
||||||
"id",
|
"id",
|
||||||
"creation_date",
|
"creation_date",
|
||||||
@ -155,14 +156,14 @@ var (
|
|||||||
"phone",
|
"phone",
|
||||||
"is_phone_verified",
|
"is_phone_verified",
|
||||||
}
|
}
|
||||||
userUniqueQuery = `SELECT projections.users4.id,` +
|
userUniqueQuery = `SELECT projections.users5.id,` +
|
||||||
` projections.users4.state,` +
|
` projections.users5.state,` +
|
||||||
` projections.users4.username,` +
|
` projections.users5.username,` +
|
||||||
` projections.users4_humans.user_id,` +
|
` projections.users5_humans.user_id,` +
|
||||||
` projections.users4_humans.email,` +
|
` projections.users5_humans.email,` +
|
||||||
` projections.users4_humans.is_email_verified` +
|
` projections.users5_humans.is_email_verified` +
|
||||||
` FROM projections.users4` +
|
` FROM projections.users5` +
|
||||||
` LEFT JOIN projections.users4_humans ON projections.users4.id = projections.users4_humans.user_id AND projections.users4.instance_id = projections.users4_humans.instance_id`
|
` LEFT JOIN projections.users5_humans ON projections.users5.id = projections.users5_humans.user_id AND projections.users5.instance_id = projections.users5_humans.instance_id`
|
||||||
userUniqueCols = []string{
|
userUniqueCols = []string{
|
||||||
"id",
|
"id",
|
||||||
"state",
|
"state",
|
||||||
@ -171,43 +172,44 @@ var (
|
|||||||
"email",
|
"email",
|
||||||
"is_email_verified",
|
"is_email_verified",
|
||||||
}
|
}
|
||||||
notifyUserQuery = `SELECT projections.users4.id,` +
|
notifyUserQuery = `SELECT projections.users5.id,` +
|
||||||
` projections.users4.creation_date,` +
|
` projections.users5.creation_date,` +
|
||||||
` projections.users4.change_date,` +
|
` projections.users5.change_date,` +
|
||||||
` projections.users4.resource_owner,` +
|
` projections.users5.resource_owner,` +
|
||||||
` projections.users4.sequence,` +
|
` projections.users5.sequence,` +
|
||||||
` projections.users4.state,` +
|
` projections.users5.state,` +
|
||||||
` projections.users4.type,` +
|
` projections.users5.type,` +
|
||||||
` projections.users4.username,` +
|
` projections.users5.username,` +
|
||||||
` login_names.loginnames,` +
|
` login_names.loginnames,` +
|
||||||
` preferred_login_name.login_name,` +
|
` preferred_login_name.login_name,` +
|
||||||
` projections.users4_humans.user_id,` +
|
` projections.users5_humans.user_id,` +
|
||||||
` projections.users4_humans.first_name,` +
|
` projections.users5_humans.first_name,` +
|
||||||
` projections.users4_humans.last_name,` +
|
` projections.users5_humans.last_name,` +
|
||||||
` projections.users4_humans.nick_name,` +
|
` projections.users5_humans.nick_name,` +
|
||||||
` projections.users4_humans.display_name,` +
|
` projections.users5_humans.display_name,` +
|
||||||
` projections.users4_humans.preferred_language,` +
|
` projections.users5_humans.preferred_language,` +
|
||||||
` projections.users4_humans.gender,` +
|
` projections.users5_humans.gender,` +
|
||||||
` projections.users4_humans.avatar_key,` +
|
` projections.users5_humans.avatar_key,` +
|
||||||
` projections.users4_notifications.user_id,` +
|
` projections.users5_notifications.user_id,` +
|
||||||
` projections.users4_notifications.last_email,` +
|
` projections.users5_notifications.last_email,` +
|
||||||
` projections.users4_notifications.verified_email,` +
|
` projections.users5_notifications.verified_email,` +
|
||||||
` projections.users4_notifications.last_phone,` +
|
` projections.users5_notifications.last_phone,` +
|
||||||
` projections.users4_notifications.verified_phone,` +
|
` projections.users5_notifications.verified_phone,` +
|
||||||
` projections.users4_notifications.password_set,` +
|
` projections.users5_notifications.password_set,` +
|
||||||
` COUNT(*) OVER ()` +
|
` COUNT(*) OVER ()` +
|
||||||
` FROM projections.users4` +
|
` FROM projections.users5` +
|
||||||
` LEFT JOIN projections.users4_humans ON projections.users4.id = projections.users4_humans.user_id AND projections.users4.instance_id = projections.users4_humans.instance_id` +
|
` LEFT JOIN projections.users5_humans ON projections.users5.id = projections.users5_humans.user_id AND projections.users5.instance_id = projections.users5_humans.instance_id` +
|
||||||
` LEFT JOIN projections.users4_notifications ON projections.users4.id = projections.users4_notifications.user_id AND projections.users4.instance_id = projections.users4_notifications.instance_id` +
|
` LEFT JOIN projections.users5_notifications ON projections.users5.id = projections.users5_notifications.user_id AND projections.users5.instance_id = projections.users5_notifications.instance_id` +
|
||||||
` LEFT JOIN` +
|
` LEFT JOIN` +
|
||||||
` (SELECT login_names.user_id, ARRAY_AGG(login_names.login_name) AS loginnames` +
|
` (SELECT login_names.user_id, ARRAY_AGG(login_names.login_name) AS loginnames, login_names.instance_id` +
|
||||||
` FROM projections.login_names AS login_names` +
|
` FROM projections.login_names AS login_names` +
|
||||||
` WHERE login_names.instance_id = $1` +
|
` GROUP BY login_names.user_id, login_names.instance_id) AS login_names` +
|
||||||
` GROUP BY login_names.user_id) AS login_names` +
|
` ON login_names.user_id = projections.users5.id AND login_names.instance_id = projections.users5.instance_id` +
|
||||||
` ON login_names.user_id = projections.users4.id` +
|
|
||||||
` LEFT JOIN` +
|
` LEFT JOIN` +
|
||||||
` (SELECT preferred_login_name.user_id, preferred_login_name.login_name FROM projections.login_names AS preferred_login_name WHERE preferred_login_name.instance_id = $2 AND preferred_login_name.is_primary = $3) AS preferred_login_name` +
|
` (SELECT preferred_login_name.user_id, preferred_login_name.login_name, preferred_login_name.instance_id` +
|
||||||
` ON preferred_login_name.user_id = projections.users4.id`
|
` FROM projections.login_names AS preferred_login_name` +
|
||||||
|
` WHERE preferred_login_name.is_primary = $1) AS preferred_login_name` +
|
||||||
|
` ON preferred_login_name.user_id = projections.users5.id AND preferred_login_name.instance_id = projections.users5.instance_id`
|
||||||
notifyUserCols = []string{
|
notifyUserCols = []string{
|
||||||
"id",
|
"id",
|
||||||
"creation_date",
|
"creation_date",
|
||||||
@ -237,43 +239,45 @@ var (
|
|||||||
"password_set",
|
"password_set",
|
||||||
"count",
|
"count",
|
||||||
}
|
}
|
||||||
usersQuery = `SELECT projections.users4.id,` +
|
usersQuery = `SELECT projections.users5.id,` +
|
||||||
` projections.users4.creation_date,` +
|
` projections.users5.creation_date,` +
|
||||||
` projections.users4.change_date,` +
|
` projections.users5.change_date,` +
|
||||||
` projections.users4.resource_owner,` +
|
` projections.users5.resource_owner,` +
|
||||||
` projections.users4.sequence,` +
|
` projections.users5.sequence,` +
|
||||||
` projections.users4.state,` +
|
` projections.users5.state,` +
|
||||||
` projections.users4.type,` +
|
` projections.users5.type,` +
|
||||||
` projections.users4.username,` +
|
` projections.users5.username,` +
|
||||||
` login_names.loginnames,` +
|
` login_names.loginnames,` +
|
||||||
` preferred_login_name.login_name,` +
|
` preferred_login_name.login_name,` +
|
||||||
` projections.users4_humans.user_id,` +
|
` projections.users5_humans.user_id,` +
|
||||||
` projections.users4_humans.first_name,` +
|
` projections.users5_humans.first_name,` +
|
||||||
` projections.users4_humans.last_name,` +
|
` projections.users5_humans.last_name,` +
|
||||||
` projections.users4_humans.nick_name,` +
|
` projections.users5_humans.nick_name,` +
|
||||||
` projections.users4_humans.display_name,` +
|
` projections.users5_humans.display_name,` +
|
||||||
` projections.users4_humans.preferred_language,` +
|
` projections.users5_humans.preferred_language,` +
|
||||||
` projections.users4_humans.gender,` +
|
` projections.users5_humans.gender,` +
|
||||||
` projections.users4_humans.avatar_key,` +
|
` projections.users5_humans.avatar_key,` +
|
||||||
` projections.users4_humans.email,` +
|
` projections.users5_humans.email,` +
|
||||||
` projections.users4_humans.is_email_verified,` +
|
` projections.users5_humans.is_email_verified,` +
|
||||||
` projections.users4_humans.phone,` +
|
` projections.users5_humans.phone,` +
|
||||||
` projections.users4_humans.is_phone_verified,` +
|
` projections.users5_humans.is_phone_verified,` +
|
||||||
` projections.users4_machines.user_id,` +
|
` projections.users5_machines.user_id,` +
|
||||||
` projections.users4_machines.name,` +
|
` projections.users5_machines.name,` +
|
||||||
` projections.users4_machines.description,` +
|
` projections.users5_machines.description,` +
|
||||||
` COUNT(*) OVER ()` +
|
` COUNT(*) OVER ()` +
|
||||||
` FROM projections.users4` +
|
` FROM projections.users5` +
|
||||||
` LEFT JOIN projections.users4_humans ON projections.users4.id = projections.users4_humans.user_id AND projections.users4.instance_id = projections.users4_humans.instance_id` +
|
` LEFT JOIN projections.users5_humans ON projections.users5.id = projections.users5_humans.user_id AND projections.users5.instance_id = projections.users5_humans.instance_id` +
|
||||||
` LEFT JOIN projections.users4_machines ON projections.users4.id = projections.users4_machines.user_id AND projections.users4.instance_id = projections.users4_machines.instance_id` +
|
` LEFT JOIN projections.users5_machines ON projections.users5.id = projections.users5_machines.user_id AND projections.users5.instance_id = projections.users5_machines.instance_id` +
|
||||||
` LEFT JOIN` +
|
` LEFT JOIN` +
|
||||||
` (SELECT login_names.user_id, ARRAY_AGG(login_names.login_name) AS loginnames` +
|
` (SELECT login_names.user_id, ARRAY_AGG(login_names.login_name) AS loginnames, login_names.instance_id` +
|
||||||
` FROM projections.login_names AS login_names` +
|
` FROM projections.login_names AS login_names` +
|
||||||
` GROUP BY login_names.user_id) AS login_names` +
|
` GROUP BY login_names.user_id, login_names.instance_id) AS login_names` +
|
||||||
` ON login_names.user_id = projections.users4.id` +
|
` ON login_names.user_id = projections.users5.id AND login_names.instance_id = projections.users5.instance_id` +
|
||||||
` LEFT JOIN` +
|
` LEFT JOIN` +
|
||||||
` (SELECT preferred_login_name.user_id, preferred_login_name.login_name FROM projections.login_names AS preferred_login_name WHERE preferred_login_name.is_primary = $1) AS preferred_login_name` +
|
` (SELECT preferred_login_name.user_id, preferred_login_name.login_name, preferred_login_name.instance_id` +
|
||||||
` ON preferred_login_name.user_id = projections.users4.id`
|
` FROM projections.login_names AS preferred_login_name` +
|
||||||
|
` WHERE preferred_login_name.is_primary = $1) AS preferred_login_name` +
|
||||||
|
` ON preferred_login_name.user_id = projections.users5.id AND preferred_login_name.instance_id = projections.users5.instance_id`
|
||||||
usersCols = []string{
|
usersCols = []string{
|
||||||
"id",
|
"id",
|
||||||
"creation_date",
|
"creation_date",
|
||||||
@ -320,7 +324,7 @@ func Test_UserPrepares(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "prepareUserQuery no result",
|
name: "prepareUserQuery no result",
|
||||||
prepare: func() (sq.SelectBuilder, func(*sql.Row) (*User, error)) {
|
prepare: func() (sq.SelectBuilder, func(*sql.Row) (*User, error)) {
|
||||||
return prepareUserQuery("instanceID")
|
return prepareUserQuery()
|
||||||
},
|
},
|
||||||
want: want{
|
want: want{
|
||||||
sqlExpectations: mockQuery(
|
sqlExpectations: mockQuery(
|
||||||
@ -340,7 +344,7 @@ func Test_UserPrepares(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "prepareUserQuery human found",
|
name: "prepareUserQuery human found",
|
||||||
prepare: func() (sq.SelectBuilder, func(*sql.Row) (*User, error)) {
|
prepare: func() (sq.SelectBuilder, func(*sql.Row) (*User, error)) {
|
||||||
return prepareUserQuery("instanceID")
|
return prepareUserQuery()
|
||||||
},
|
},
|
||||||
want: want{
|
want: want{
|
||||||
sqlExpectations: mockQuery(
|
sqlExpectations: mockQuery(
|
||||||
@ -407,7 +411,7 @@ func Test_UserPrepares(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "prepareUserQuery machine found",
|
name: "prepareUserQuery machine found",
|
||||||
prepare: func() (sq.SelectBuilder, func(*sql.Row) (*User, error)) {
|
prepare: func() (sq.SelectBuilder, func(*sql.Row) (*User, error)) {
|
||||||
return prepareUserQuery("instanceID")
|
return prepareUserQuery()
|
||||||
},
|
},
|
||||||
want: want{
|
want: want{
|
||||||
sqlExpectations: mockQuery(
|
sqlExpectations: mockQuery(
|
||||||
@ -465,7 +469,7 @@ func Test_UserPrepares(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "prepareUserQuery sql err",
|
name: "prepareUserQuery sql err",
|
||||||
prepare: func() (sq.SelectBuilder, func(*sql.Row) (*User, error)) {
|
prepare: func() (sq.SelectBuilder, func(*sql.Row) (*User, error)) {
|
||||||
return prepareUserQuery("instanceID")
|
return prepareUserQuery()
|
||||||
},
|
},
|
||||||
want: want{
|
want: want{
|
||||||
sqlExpectations: mockQueryErr(
|
sqlExpectations: mockQueryErr(
|
||||||
@ -832,7 +836,7 @@ func Test_UserPrepares(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "prepareNotifyUserQuery no result",
|
name: "prepareNotifyUserQuery no result",
|
||||||
prepare: func() (sq.SelectBuilder, func(*sql.Row) (*NotifyUser, error)) {
|
prepare: func() (sq.SelectBuilder, func(*sql.Row) (*NotifyUser, error)) {
|
||||||
return prepareNotifyUserQuery("instanceID")
|
return prepareNotifyUserQuery()
|
||||||
},
|
},
|
||||||
want: want{
|
want: want{
|
||||||
sqlExpectations: mockQuery(
|
sqlExpectations: mockQuery(
|
||||||
@ -852,7 +856,7 @@ func Test_UserPrepares(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "prepareNotifyUserQuery notify found",
|
name: "prepareNotifyUserQuery notify found",
|
||||||
prepare: func() (sq.SelectBuilder, func(*sql.Row) (*NotifyUser, error)) {
|
prepare: func() (sq.SelectBuilder, func(*sql.Row) (*NotifyUser, error)) {
|
||||||
return prepareNotifyUserQuery("instanceID")
|
return prepareNotifyUserQuery()
|
||||||
},
|
},
|
||||||
want: want{
|
want: want{
|
||||||
sqlExpectations: mockQuery(
|
sqlExpectations: mockQuery(
|
||||||
@ -917,7 +921,7 @@ func Test_UserPrepares(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "prepareNotifyUserQuery not notify found (error)",
|
name: "prepareNotifyUserQuery not notify found (error)",
|
||||||
prepare: func() (sq.SelectBuilder, func(*sql.Row) (*NotifyUser, error)) {
|
prepare: func() (sq.SelectBuilder, func(*sql.Row) (*NotifyUser, error)) {
|
||||||
return prepareNotifyUserQuery("instanceID")
|
return prepareNotifyUserQuery()
|
||||||
},
|
},
|
||||||
want: want{
|
want: want{
|
||||||
sqlExpectations: mockQuery(
|
sqlExpectations: mockQuery(
|
||||||
@ -964,7 +968,7 @@ func Test_UserPrepares(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "prepareNotifyUserQuery sql err",
|
name: "prepareNotifyUserQuery sql err",
|
||||||
prepare: func() (sq.SelectBuilder, func(*sql.Row) (*NotifyUser, error)) {
|
prepare: func() (sq.SelectBuilder, func(*sql.Row) (*NotifyUser, error)) {
|
||||||
return prepareNotifyUserQuery("instanceID")
|
return prepareNotifyUserQuery()
|
||||||
},
|
},
|
||||||
want: want{
|
want: want{
|
||||||
sqlExpectations: mockQueryErr(
|
sqlExpectations: mockQueryErr(
|
||||||
@ -981,8 +985,10 @@ func Test_UserPrepares(t *testing.T) {
|
|||||||
object: nil,
|
object: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "prepareUsersQuery no result",
|
name: "prepareUsersQuery no result",
|
||||||
prepare: prepareUsersQuery,
|
prepare: func() (sq.SelectBuilder, func(*sql.Rows) (*Users, error)) {
|
||||||
|
return prepareUsersQuery()
|
||||||
|
},
|
||||||
want: want{
|
want: want{
|
||||||
sqlExpectations: mockQueries(
|
sqlExpectations: mockQueries(
|
||||||
regexp.QuoteMeta(usersQuery),
|
regexp.QuoteMeta(usersQuery),
|
||||||
@ -999,8 +1005,10 @@ func Test_UserPrepares(t *testing.T) {
|
|||||||
object: &Users{Users: []*User{}},
|
object: &Users{Users: []*User{}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "prepareUsersQuery one result",
|
name: "prepareUsersQuery one result",
|
||||||
prepare: prepareUsersQuery,
|
prepare: func() (sq.SelectBuilder, func(*sql.Rows) (*Users, error)) {
|
||||||
|
return prepareUsersQuery()
|
||||||
|
},
|
||||||
want: want{
|
want: want{
|
||||||
sqlExpectations: mockQueries(
|
sqlExpectations: mockQueries(
|
||||||
regexp.QuoteMeta(usersQuery),
|
regexp.QuoteMeta(usersQuery),
|
||||||
@ -1072,8 +1080,10 @@ func Test_UserPrepares(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "prepareUsersQuery multiple results",
|
name: "prepareUsersQuery multiple results",
|
||||||
prepare: prepareUsersQuery,
|
prepare: func() (sq.SelectBuilder, func(*sql.Rows) (*Users, error)) {
|
||||||
|
return prepareUsersQuery()
|
||||||
|
},
|
||||||
want: want{
|
want: want{
|
||||||
sqlExpectations: mockQueries(
|
sqlExpectations: mockQueries(
|
||||||
regexp.QuoteMeta(usersQuery),
|
regexp.QuoteMeta(usersQuery),
|
||||||
@ -1190,8 +1200,10 @@ func Test_UserPrepares(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "prepareUsersQuery sql err",
|
name: "prepareUsersQuery sql err",
|
||||||
prepare: prepareUsersQuery,
|
prepare: func() (sq.SelectBuilder, func(*sql.Rows) (*Users, error)) {
|
||||||
|
return prepareUsersQuery()
|
||||||
|
},
|
||||||
want: want{
|
want: want{
|
||||||
sqlExpectations: mockQueryErr(
|
sqlExpectations: mockQueryErr(
|
||||||
regexp.QuoteMeta(usersQuery),
|
regexp.QuoteMeta(usersQuery),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user