diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-23 18:27:09 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-23 18:27:09 +0000 |
commit | bcc70301531b6c3118120173389f2aaa7452bf11 (patch) | |
tree | 161f1ee56e15ec9e59f48c5e1a9cb86b62469a49 /lib/gitlab/database.rb | |
parent | d47fc5085a706ab37d038636c9d5934da69853f0 (diff) | |
download | gitlab-ce-bcc70301531b6c3118120173389f2aaa7452bf11.tar.gz |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'lib/gitlab/database.rb')
-rw-r--r-- | lib/gitlab/database.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/gitlab/database.rb b/lib/gitlab/database.rb index 2bfb6c32886..d88ca6d7fe3 100644 --- a/lib/gitlab/database.rb +++ b/lib/gitlab/database.rb @@ -13,11 +13,15 @@ module Gitlab # so administrators can prepare to upgrade UPCOMING_POSTGRES_VERSION_DETAILS = { gl_version: '13.6.0', - gl_version_date: 'November 2020', + gl_version_date: 'November 22, 2020', pg_version_minimum: 12, url: 'https://gitlab.com/groups/gitlab-org/-/epics/2374' }.freeze + # Specifies the maximum number of days in advance to display a notice + # regarding an upcoming PostgreSQL version deprecation. + DEPRECATION_WINDOW_DAYS = 90 + # https://www.postgresql.org/docs/9.2/static/datatype-numeric.html MAX_INT_VALUE = 2147483647 @@ -119,6 +123,18 @@ module Gitlab version.to_f < UPCOMING_POSTGRES_VERSION_DETAILS[:pg_version_minimum] end + def self.days_until_deprecation + ( + Date.parse(UPCOMING_POSTGRES_VERSION_DETAILS[:gl_version_date]) - + Date.today + ).to_i + end + private_class_method :days_until_deprecation + + def self.within_deprecation_notice_window? + days_until_deprecation <= DEPRECATION_WINDOW_DAYS + end + def self.check_postgres_version_and_print_warning return if Gitlab::Database.postgresql_minimum_supported_version? return if Gitlab::Runtime.rails_runner? |