Merge pull request 'fix: don't specify FOR clause for index hint' (#6188) from gusted/forgejo-mariadb-2 into forgejo
Some checks are pending
/ release (push) Waiting to run
testing / backend-checks (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / test-e2e (push) Blocked by required conditions
testing / test-remote-cacher (redis) (push) Blocked by required conditions
testing / test-remote-cacher (valkey) (push) Blocked by required conditions
testing / test-remote-cacher (garnet) (push) Blocked by required conditions
testing / test-remote-cacher (redict) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6188
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
Earl Warren 2024-12-07 06:46:42 +00:00
commit 48131547a1

View file

@ -113,7 +113,7 @@ func getNotifications(ctx *context.Context) {
sess := db.GetEngine(ctx).Table("notification")
if setting.Database.Type.IsMySQL() {
sess = sess.IndexHint("USE", "JOIN", "IDX_notification_user_id")
sess = sess.IndexHint("USE", "", "IDX_notification_user_id")
}
sess.Where("user_id = ?", ctx.Doer.ID).
And("status = ? OR status = ?", status, activities_model.NotificationStatusPinned).