Added updated to releases api
What does this MR do and why?
Added updated_before
and updated_after
to the releases API.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
Use the command line to make an API request
curl --header "PRIVATE-TOKEN: <token>" "http://localhost:3000/api/v4/projects/:id/releases?updated_before=2014-02-17T09%3A24%3A18Z"
DB review
https://console.postgres.ai/shared/4c41ae8b-c194-445f-bbdc-2d47903031e7
SELECT
releases.*
FROM
releases
WHERE
releases.project_id = 278964 AND
(
NOT (
releases.tag = '' OR
releases.tag IS NULL
)
) AND
releases.updated_at <= '2024-01-01 23:09:43.408000'
ORDER BY
releases.released_at DESC
LIMIT 20
OFFSET 0;
Added index
[I] ➜ bin/rails db:migrate:up:main db:migrate:up:ci VERSION=20240125211243
main: == [advisory_lock_connection] object_id: 181420, pg_backend_pid: 26839
main: == 20240125211243 IndexReleasesOnProjectIdAndUpdatedAtAndReleasedAt: migrating
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main: -> 0.1243s
main: -- index_exists?(:releases, [:project_id, :updated_at, :released_at], {:name=>"index_releases_on_project_id_updated_at_released_at", :algorithm=>:concurrently})
main: -> 0.0039s
main: -- execute("SET statement_timeout TO 0")
main: -> 0.0007s
main: -- add_index(:releases, [:project_id, :updated_at, :released_at], {:name=>"index_releases_on_project_id_updated_at_released_at", :algorithm=>:concurrently})
main: -> 0.0068s
main: -- execute("RESET statement_timeout")
main: -> 0.0003s
main: == 20240125211243 IndexReleasesOnProjectIdAndUpdatedAtAndReleasedAt: migrated (0.1526s)
main: == [advisory_lock_connection] object_id: 181420, pg_backend_pid: 26839
ci: == [advisory_lock_connection] object_id: 197160, pg_backend_pid: 27203
ci: == 20240125211243 IndexReleasesOnProjectIdAndUpdatedAtAndReleasedAt: migrating
ci: -- transaction_open?(nil)
ci: -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci: -> 0.0007s
ci: -- index_exists?(:releases, [:project_id, :updated_at, :released_at], {:name=>"index_releases_on_project_id_updated_at_released_at", :algorithm=>:concurrently})
ci: -> 0.0043s
ci: -- execute("SET statement_timeout TO 0")
ci: -> 0.0002s
ci: -- add_index(:releases, [:project_id, :updated_at, :released_at], {:name=>"index_releases_on_project_id_updated_at_released_at", :algorithm=>:concurrently})
ci: -> 0.0051s
ci: -- execute("RESET statement_timeout")
ci: -> 0.0003s
ci: == 20240125211243 IndexReleasesOnProjectIdAndUpdatedAtAndReleasedAt: migrated (0.0277s)
ci: == [advisory_lock_connection] object_id: 197160, pg_backend_pid: 27203
Related to #393981 (closed)
Edited by Donald Cook