Sorting milestones by name returns a 500
Summary
Sorting milestones by name returns a 500.
Steps to reproduce
- go to any project
- go to the milestones page
- attempt to sort by
Name, ascending
orName, descending
- be greeted with a HTTP
500 Internal Server Error
Failing URL is, like, https://gitlab.example.com/foo/bar/milestones?sort=name_asc&state=closed
Example Project
(If possible, please create an example project here on GitLab.com that exhibits the problematic behaviour, and link to it here in the bug report)
(If you are using an older version of GitLab, this will also determine whether the bug has been fixed in a more recent version)
What is the current bug behavior?
HTTP 500 Internal Server Error
What is the expected correct behavior?
Sorted list of milestones.
Relevant logs and/or screenshots
Started GET "/foo/bar/milestones?sort=name_asc&state=closed" for 46.xxx.xxx.xxx at 2018-08-02 11:54:54 +0200
Processing by Projects::MilestonesController#index as HTML
Parameters: {"sort"=>"name_asc", "state"=>"closed", "namespace_id"=>"foo", "project_id"=>"bar"}
Completed 500 Internal Server Error in 35ms (ActiveRecord: 6.0ms | Elasticsearch: 0.0ms)
ActionView::Template::Error (PG::UndefinedColumn: ERROR: column milestones.name does not exist
LINE 1: ...D "milestones"."group_id" IS NULL ORDER BY LOWER("milestone...
^
: SELECT "milestones".* FROM "milestones" WHERE "milestones"."project_id" IN (127) AND ("milestones"."state" IN ('closed')) AND "milestones"."group_id" IS NULL ORDER BY LOWER("milestones"."name") ASC LIMIT 20 OFFSET 0):
16: #promote-milestone-modal
17:
18: %ul.content-list
19: = render @milestones
20:
21: - if @milestones.blank?
22: %li
app/views/projects/milestones/index.html.haml:19:in `_app_views_projects_milestones_index_html_haml___4158605274928170070_70094445057340'
lib/gitlab/i18n.rb:51:in `with_locale'
lib/gitlab/i18n.rb:57:in `with_user_locale'
app/controllers/application_controller.rb:370:in `set_locale'
lib/gitlab/middleware/multipart.rb:97:in `call'
lib/gitlab/request_profiler/middleware.rb:14:in `call'
ee/lib/gitlab/jira/middleware.rb:15:in `call'
lib/gitlab/middleware/go.rb:17:in `call'
lib/gitlab/etag_caching/middleware.rb:11:in `call'
lib/gitlab/middleware/read_only/controller.rb:38:in `call'
lib/gitlab/middleware/read_only.rb:16:in `call'
lib/gitlab/request_context.rb:18:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'
lib/gitlab/middleware/release_env.rb:10:in `call'
Output of checks
This bug happens on GitLab.com
Possible fixes
Hint hint:
PG::UndefinedColumn: ERROR: column milestones.name does not exist