Skip to content

Add updated_at timestamp to PlanLimits

Vijay Hawoldar requested to merge vij-plan-limits-timestamp into master

What does this MR do and why?

This MR adds the updated_at column to the plan_limits table for tracking when the records were last updated.

The column can be used for convenience with the recent addition of Admin Controls (https://gitlab.com/groups/gitlab-org/-/epics/9173) and also for caching and being able to generate a cache key from the timestamp.

Refs #419618 (closed)

Database info

up

 bin/rails db:migrate
main: == [advisory_lock_connection] object_id: 224140, pg_backend_pid: 88317
main: == 20230725075011 AddUpdatedAtToPlanLimits: migrating =========================
main: -- add_column(:plan_limits, :updated_at, :datetime_with_timezone)
main:    -> 0.0015s
main: == 20230725075011 AddUpdatedAtToPlanLimits: migrated (0.0051s) ================

main: == [advisory_lock_connection] object_id: 224140, pg_backend_pid: 88317
ci: == [advisory_lock_connection] object_id: 224400, pg_backend_pid: 88319
ci: == 20230725075011 AddUpdatedAtToPlanLimits: migrating =========================
ci: -- add_column(:plan_limits, :updated_at, :datetime_with_timezone)
ci:    -> 0.0033s
ci: == 20230725075011 AddUpdatedAtToPlanLimits: migrated (0.0117s) ================

down

bin/rails db:migrate:down:main VERSION=20230725075011
main: == [advisory_lock_connection] object_id: 223860, pg_backend_pid: 89444
main: == 20230725075011 AddUpdatedAtToPlanLimits: reverting =========================
main: -- remove_column(:plan_limits, :updated_at, :datetime_with_timezone)
main:    -> 0.0014s
main: == 20230725075011 AddUpdatedAtToPlanLimits: reverted (0.0073s) ================

main: == [advisory_lock_connection] object_id: 223860, pg_backend_pid: 89444

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

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

Edited by Vijay Hawoldar

Merge request reports