Skip to content

Commit

Permalink
Merge pull request #285 from stephenafamo/issue-284
Browse files Browse the repository at this point in the history
Fix issue with relation queries with RelatedWhere
  • Loading branch information
stephenafamo authored Oct 16, 2024
2 parents 5660ca7 + 9a3c704 commit e0aad95
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed data races in unit tests. (thanks @mbezhanov)
- Fixed invalid SQL statements generated by `sm.OrderBy().Collate()`. (thanks @mbezhanov)
- Fixed a bug preventing specific columns from being excluded when generating models from SQLite. (thanks @mbezhanov)
- Fixed an issue where invalid code is generated if a configured relationship has `from_where` or `to_where`.

## [v0.28.1] - 2024-06-28

Expand Down
4 changes: 2 additions & 2 deletions gen/templates/models/09_rel_query.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ func (os {{$tAlias.UpSingular}}Slice) {{relQueryMethodName $tAlias $relAlias}}(c
{{- end}}
{{- range $where := $side.FromWhere}}
{{- $fromCol := index $from.Columns $where.Column}}
sm.Where({{$from.UpSingular}}Columns.{{$fromCol}}.EQ({{$.Dialect}}.Arg({{quote $where.SQLValue}}))),
{{$from.UpSingular}}Columns.{{$fromCol}}.EQ({{$.Dialect}}.Arg({{quote $where.SQLValue}})),
{{- end}}
{{- range $where := $side.ToWhere}}
{{- $toCol := index $to.Columns $where.Column}}
sm.Where({{$to.UpSingular}}Columns.{{$toCol}}.EQ({{$.Dialect}}.Arg({{quote $where.SQLValue}}))),
{{$to.UpSingular}}Columns.{{$toCol}}.EQ({{$.Dialect}}.Arg({{quote $where.SQLValue}})),
{{- end}}
),
{{- else -}}
Expand Down

0 comments on commit e0aad95

Please sign in to comment.