Commit f35d7d7f authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch '37231-mysql2-error-unknown-column-award_emoji-count-on-master' into 'master'

Resolve "Mysql2::Error: Unknown column 'award_emoji.count' on master"

Closes #37231

See merge request !13926
parents f1d9dc81 b9d89463
...@@ -55,7 +55,7 @@ class AutocompleteController < ApplicationController ...@@ -55,7 +55,7 @@ class AutocompleteController < ApplicationController
.limit(AWARD_EMOJI_MAX) .limit(AWARD_EMOJI_MAX)
.where(user: current_user) .where(user: current_user)
.group(:name) .group(:name)
.order(count: :desc, name: :asc) .order('count_all DESC, name ASC')
.count .count
# Transform from hash to array to guarantee json order # Transform from hash to array to guarantee json order
......
...@@ -130,7 +130,7 @@ module API ...@@ -130,7 +130,7 @@ module API
commit = user_project.repository.commit(branch.dereferenced_target) commit = user_project.repository.commit(branch.dereferenced_target)
destroy_conditionally!(commit, last_update_field: :authored_date) do destroy_conditionally!(commit, last_updated: commit.authored_date) do
result = DeleteBranchService.new(user_project, current_user) result = DeleteBranchService.new(user_project, current_user)
.execute(params[:branch]) .execute(params[:branch])
......
...@@ -19,8 +19,10 @@ module API ...@@ -19,8 +19,10 @@ module API
end end
end end
def destroy_conditionally!(resource, last_update_field: :updated_at) def destroy_conditionally!(resource, last_updated: nil)
check_unmodified_since!(resource.public_send(last_update_field)) last_updated ||= resource.updated_at
check_unmodified_since!(last_updated)
status 204 status 204
if block_given? if block_given?
......
...@@ -70,7 +70,7 @@ module API ...@@ -70,7 +70,7 @@ module API
commit = user_project.repository.commit(tag.dereferenced_target) commit = user_project.repository.commit(tag.dereferenced_target)
destroy_conditionally!(commit, last_update_field: :authored_date) do destroy_conditionally!(commit, last_updated: commit.authored_date) do
result = ::Tags::DestroyService.new(user_project, current_user) result = ::Tags::DestroyService.new(user_project, current_user)
.execute(params[:tag_name]) .execute(params[:tag_name])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment