Skip to content

Add snippets_size to namespace_root_storage_statistics table

What does this MR do?

This MR adds the new column snippets_size to the table namespace_root_storage_statistics.

The new column is added with a default value and as not null. Why setting the default value? Because that column will be used to perform calc operations like SUM, AVG, ..., and dealing with possible nil values can be problematic.

The number of records in prod of this table is around 1.3M. It's big but not that big to totally avoid setting the default value.

Refs #224486 (closed)

bin/rake db:migrate

== 20200625082258 AddSnippetsSizeToRootStorageStatistics: migrating ===========
-- add_column(:namespace_root_storage_statistics, :snippets_size, :bigint, {:default=>0, :null=>false})
   -> 0.0061s
== 20200625082258 AddSnippetsSizeToRootStorageStatistics: migrated (0.0214s) ==

bin/rake db:rollback

== 20200625082258 AddSnippetsSizeToRootStorageStatistics: reverting ===========
-- remove_column(:namespace_root_storage_statistics, :snippets_size)
   -> 0.0047s
== 20200625082258 AddSnippetsSizeToRootStorageStatistics: reverted (0.0048s) ==

Does this MR meet the acceptance criteria?

Conformity

Edited by 🤖 GitLab Bot 🤖

Merge request reports