Skip to content

Add `latest_released_at` column to catalog_resources table

Leaminn Ma requested to merge add-latest-released-at-to-ci-resources into master

What does this MR do and why?

This is a migration to add the latest_released_at column to the table catalog_resources. This column is a date-time type and is nullable. It will be used to contain the latest released_at date from the Catalog Resource's valid Releases (aka "Versions").

The purpose of this column is to allow for more efficient sorting of Catalog Resources based on each of their latest Release's released_at date.

Resolves the first step of #408382 (closed).

Migrations

Up

main: == [advisory_lock_connection] object_id: 227500, pg_backend_pid: 76243
main: == 20230922004506 AddLatestReleasedAtToCatalogResources: migrating ============
main: -- add_column(:catalog_resources, :latest_released_at, :datetime_with_timezone, {:null=>true})
main:    -> 0.0020s
main: == 20230922004506 AddLatestReleasedAtToCatalogResources: migrated (0.0050s) ===

main: == [advisory_lock_connection] object_id: 227500, pg_backend_pid: 76243
ci: == [advisory_lock_connection] object_id: 227940, pg_backend_pid: 76245
ci: == 20230922004506 AddLatestReleasedAtToCatalogResources: migrating ============
ci: -- add_column(:catalog_resources, :latest_released_at, :datetime_with_timezone, {:null=>true})
ci:    -> 0.0021s
ci: == 20230922004506 AddLatestReleasedAtToCatalogResources: migrated (0.0084s) ===

ci: == [advisory_lock_connection] object_id: 227940, pg_backend_pid: 76245

Down

main: == [advisory_lock_connection] object_id: 227200, pg_backend_pid: 76905
main: == 20230922004506 AddLatestReleasedAtToCatalogResources: reverting ============
main: -- remove_column(:catalog_resources, :latest_released_at, :datetime_with_timezone, {:null=>true})
main:    -> 0.0019s
main: == 20230922004506 AddLatestReleasedAtToCatalogResources: reverted (0.0085s) ===

main: == [advisory_lock_connection] object_id: 227200, pg_backend_pid: 76905
ci: == [advisory_lock_connection] object_id: 227140, pg_backend_pid: 77334
ci: == 20230922004506 AddLatestReleasedAtToCatalogResources: reverting ============
ci: -- remove_column(:catalog_resources, :latest_released_at, :datetime_with_timezone, {:null=>true})
ci:    -> 0.0017s
ci: == 20230922004506 AddLatestReleasedAtToCatalogResources: reverted (0.0107s) ===

ci: == [advisory_lock_connection] object_id: 227140, pg_backend_pid: 77334

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #408382 (closed)

Edited by Leaminn Ma

Merge request reports