Commit effc80e2 authored by Andreas Brandl's avatar Andreas Brandl

Merge branch '33099-add-pipelines-api-order-by-updated-at' into 'master'

Add order_by updated_at to Pipelines API

See merge request gitlab-org/gitlab!19886
parents dd3a73f2 afedb86e
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
class PipelinesFinder class PipelinesFinder
attr_reader :project, :pipelines, :params, :current_user attr_reader :project, :pipelines, :params, :current_user
ALLOWED_INDEXED_COLUMNS = %w[id status ref user_id].freeze ALLOWED_INDEXED_COLUMNS = %w[id status ref updated_at user_id].freeze
def initialize(project, current_user, params = {}) def initialize(project, current_user, params = {})
@project = project @project = project
......
---
title: Allow order_by updated_at in Pipelines API
merge_request: 19886
author:
type: added
# frozen_string_literal: true
class AddIndexOnCiPipelinesUpdatedAt < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_COLUMNS = [:project_id, :status, :updated_at]
disable_ddl_transaction!
def up
add_concurrent_index(:ci_pipelines, INDEX_COLUMNS)
end
def down
remove_concurrent_index(:ci_pipelines, INDEX_COLUMNS)
end
end
...@@ -851,6 +851,7 @@ ActiveRecord::Schema.define(version: 2019_11_19_023952) do ...@@ -851,6 +851,7 @@ ActiveRecord::Schema.define(version: 2019_11_19_023952) do
t.index ["project_id", "sha"], name: "index_ci_pipelines_on_project_id_and_sha" t.index ["project_id", "sha"], name: "index_ci_pipelines_on_project_id_and_sha"
t.index ["project_id", "source"], name: "index_ci_pipelines_on_project_id_and_source" t.index ["project_id", "source"], name: "index_ci_pipelines_on_project_id_and_source"
t.index ["project_id", "status", "config_source"], name: "index_ci_pipelines_on_project_id_and_status_and_config_source" t.index ["project_id", "status", "config_source"], name: "index_ci_pipelines_on_project_id_and_status_and_config_source"
t.index ["project_id", "status", "updated_at"], name: "index_ci_pipelines_on_project_id_and_status_and_updated_at"
t.index ["project_id"], name: "index_ci_pipelines_on_project_id" t.index ["project_id"], name: "index_ci_pipelines_on_project_id"
t.index ["status"], name: "index_ci_pipelines_on_status" t.index ["status"], name: "index_ci_pipelines_on_status"
t.index ["user_id"], name: "index_ci_pipelines_on_user_id" t.index ["user_id"], name: "index_ci_pipelines_on_user_id"
......
...@@ -18,7 +18,7 @@ GET /projects/:id/pipelines ...@@ -18,7 +18,7 @@ GET /projects/:id/pipelines
| `yaml_errors`| boolean | no | Returns pipelines with invalid configurations | | `yaml_errors`| boolean | no | Returns pipelines with invalid configurations |
| `name`| string | no | The name of the user who triggered pipelines | | `name`| string | no | The name of the user who triggered pipelines |
| `username`| string | no | The username of the user who triggered pipelines | | `username`| string | no | The username of the user who triggered pipelines |
| `order_by`| string | no | Order pipelines by `id`, `status`, `ref`, or `user_id` (default: `id`) | | `order_by`| string | no | Order pipelines by `id`, `status`, `ref`, `updated_at` or `user_id` (default: `id`) |
| `sort` | string | no | Sort pipelines in `asc` or `desc` order (default: `desc`) | | `sort` | string | no | Sort pipelines in `asc` or `desc` order (default: `desc`) |
``` ```
......
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