Don't select join table's columns (#19660)

* Don't select join table

* Add comment
tokarchuk/v1.17
Lunny Xiao 3 years ago committed by GitHub
parent cd99540cdc
commit e435283c0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      models/action.go

@ -340,7 +340,9 @@ func GetFeeds(ctx context.Context, opts GetFeedsOptions) (ActionList, error) {
} }
e := db.GetEngine(ctx) e := db.GetEngine(ctx)
sess := e.Where(cond).Join("INNER", "repository", "`repository`.id = `action`.repo_id") sess := e.Where(cond).
Select("`action`.*"). // this line will avoid select other joined table's columns
Join("INNER", "repository", "`repository`.id = `action`.repo_id")
opts.SetDefaultValues() opts.SetDefaultValues()
sess = db.SetSessionPagination(sess, &opts) sess = db.SetSessionPagination(sess, &opts)

Loading…
Cancel
Save