mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:37:32 +00:00
fix: join on instanceIDs in queries (#4612)
This commit is contained in:
@@ -365,8 +365,9 @@ var (
|
||||
)
|
||||
|
||||
type table struct {
|
||||
name string
|
||||
alias string
|
||||
name string
|
||||
alias string
|
||||
instanceIDCol string
|
||||
}
|
||||
|
||||
func (t table) setAlias(a string) table {
|
||||
@@ -385,6 +386,13 @@ func (t table) isZero() bool {
|
||||
return t.name == ""
|
||||
}
|
||||
|
||||
func (t table) InstanceIDIdentifier() string {
|
||||
if t.alias != "" {
|
||||
return t.alias + "." + t.instanceIDCol
|
||||
}
|
||||
return t.name + "." + t.instanceIDCol
|
||||
}
|
||||
|
||||
type Column struct {
|
||||
name string
|
||||
table table
|
||||
@@ -418,7 +426,7 @@ func (c Column) isZero() bool {
|
||||
}
|
||||
|
||||
func join(join, from Column) string {
|
||||
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()
|
||||
}
|
||||
|
||||
type listContains struct {
|
||||
|
Reference in New Issue
Block a user