Add updated_at column to project_statistics table
What does this MR do and why?
Whilst investigating problems with storage statistics within the project_statistics
table, we identified that we do not have timestamp columns in the table, making it difficult to ascertain when the last time rows in the table were created/updated.
This MR adds the columns to the table for Rails to populate when the records are touched.
Refs https://gitlab.com/gitlab-org/gitlab/-/issues/368219
Migrate up:
main: == 20220808133824 AddTimestampsToProjectStatistics: migrating =================
main: -- add_column(:project_statistics, :created_at, :datetime_with_timezone, {:default=>#<Proc:0x000000011110f268 /Users/vij/code/gdk/gitlab/db/migrate/20220808133824_add_timestamps_to_project_statistics.rb:5 (lambda)>, :null=>false})
main: -> 0.0053s
main: -- add_column(:project_statistics, :updated_at, :datetime_with_timezone, {:default=>#<Proc:0x000000011110f268 /Users/vij/code/gdk/gitlab/db/migrate/20220808133824_add_timestamps_to_project_statistics.rb:5 (lambda)>, :null=>false})
main: -> 0.0006s
main: == 20220808133824 AddTimestampsToProjectStatistics: migrated (0.0063s) ========
ci: == 20220808133824 AddTimestampsToProjectStatistics: migrating =================
ci: -- add_column(:project_statistics, :created_at, :datetime_with_timezone, {:default=>#<Proc:0x00000001109df2b8 /Users/vij/code/gdk/gitlab/db/migrate/20220808133824_add_timestamps_to_project_statistics.rb:5 (lambda)>, :null=>false})
ci: -> 0.0036s
ci: -- add_column(:project_statistics, :updated_at, :datetime_with_timezone, {:default=>#<Proc:0x00000001109df2b8 /Users/vij/code/gdk/gitlab/db/migrate/20220808133824_add_timestamps_to_project_statistics.rb:5 (lambda)>, :null=>false})
ci: -> 0.0023s
ci: == 20220808133824 AddTimestampsToProjectStatistics: migrated (0.0060s) ========
Migrate down:
main: == 20220808133824 AddTimestampsToProjectStatistics: reverting =================
main: -- remove_column(:project_statistics, :updated_at, :datetime_with_timezone, {:default=>#<Proc:0x0000000137a3ddc8 /Users/vij/code/gdk/gitlab/db/migrate/20220808133824_add_timestamps_to_project_statistics.rb:5 (lambda)>, :null=>false})
main: -> 0.0038s
main: -- remove_column(:project_statistics, :created_at, :datetime_with_timezone, {:default=>#<Proc:0x0000000137a3ddc8 /Users/vij/code/gdk/gitlab/db/migrate/20220808133824_add_timestamps_to_project_statistics.rb:5 (lambda)>, :null=>false})
main: -> 0.0005s
main: == 20220808133824 AddTimestampsToProjectStatistics: reverted (0.0054s) ========
ci: == 20220808133824 AddTimestampsToProjectStatistics: reverting =================
ci: -- remove_column(:project_statistics, :updated_at, :datetime_with_timezone, {:default=>#<Proc:0x0000000127972048 /Users/vij/code/gdk/gitlab/db/migrate/20220808133824_add_timestamps_to_project_statistics.rb:5 (lambda)>, :null=>false})
ci: -> 0.0067s
ci: -- remove_column(:project_statistics, :created_at, :datetime_with_timezone, {:default=>#<Proc:0x0000000127972048 /Users/vij/code/gdk/gitlab/db/migrate/20220808133824_add_timestamps_to_project_statistics.rb:5 (lambda)>, :null=>false})
ci: -> 0.0005s
ci: == 20220808133824 AddTimestampsToProjectStatistics: reverted (0.0086s) ========
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Vijay Hawoldar