Commit 6e76134d authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'display-db-deprecation-notice' into 'master'

Display DB deprecation notice for PostgreSQL 11

Closes omnibus-gitlab#5096

See merge request gitlab-org/gitlab!30389
parents 34da1ea0 873c405f
...@@ -13,6 +13,7 @@ class Admin::DashboardController < Admin::ApplicationController ...@@ -13,6 +13,7 @@ class Admin::DashboardController < Admin::ApplicationController
@users = User.order_id_desc.limit(10) @users = User.order_id_desc.limit(10)
@groups = Group.order_id_desc.with_route.limit(10) @groups = Group.order_id_desc.with_route.limit(10)
@notices = Gitlab::ConfigChecker::PumaRuggedChecker.check @notices = Gitlab::ConfigChecker::PumaRuggedChecker.check
@notices += Gitlab::ConfigChecker::ExternalDatabaseChecker.check
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
......
---
title: Implement external database checker in dashboard controller
merge_request: 30389
author:
type: deprecated
...@@ -139,9 +139,12 @@ MySQL/MariaDB are advised to [migrate to PostgreSQL](../update/mysql_to_postgres ...@@ -139,9 +139,12 @@ MySQL/MariaDB are advised to [migrate to PostgreSQL](../update/mysql_to_postgres
### PostgreSQL Requirements ### PostgreSQL Requirements
As of GitLab 10.0, PostgreSQL 9.6 or newer is required, and earlier versions are We highly recommend users to use the minimum PostgreSQL versions specified below as these are the versions used for development and testing.
not supported. We highly recommend users to use PostgreSQL 9.6 as this
is the PostgreSQL version used for development and testing. GitLab version | Minimum PostgreSQL version
-|-
10.0 | 9.6
12.10 | 11
Users using PostgreSQL must ensure the `pg_trgm` extension is loaded into every Users using PostgreSQL must ensure the `pg_trgm` extension is loaded into every
GitLab database. This extension can be enabled (using a PostgreSQL super user) GitLab database. This extension can be enabled (using a PostgreSQL super user)
......
# frozen_string_literal: true
module Gitlab
module ConfigChecker
module ExternalDatabaseChecker
extend self
# DB is considered deprecated if it is below version 11
def db_version_deprecated?
Gitlab::Database.version.to_f < 11
end
def check
return [] unless db_version_deprecated?
[
{
type: 'warning',
message: _('Note that PostgreSQL 11 will become the minimum required PostgreSQL version in GitLab 13.0 (May 2020). '\
'PostgreSQL 9.6 and PostgreSQL 10 will no longer be supported in GitLab 13.0. '\
'Please consider upgrading your PostgreSQL version (%{db_version}) soon.') % { db_version: Gitlab::Database.version.to_s }
}
]
end
end
end
end
...@@ -8,6 +8,8 @@ msgid "" ...@@ -8,6 +8,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: gitlab 1.0.0\n" "Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-04-24 17:33-0400\n"
"PO-Revision-Date: 2020-04-24 17:33-0400\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n" "Language: \n"
...@@ -14171,6 +14173,9 @@ msgstr "" ...@@ -14171,6 +14173,9 @@ msgstr ""
msgid "Note parameters are invalid: %{errors}" msgid "Note parameters are invalid: %{errors}"
msgstr "" msgstr ""
msgid "Note that PostgreSQL 11 will become the minimum required PostgreSQL version in GitLab 13.0 (May 2020). PostgreSQL 9.6 and PostgreSQL 10 will no longer be supported in GitLab 13.0. Please consider upgrading your PostgreSQL version (%{db_version}) soon."
msgstr ""
msgid "Note that this invitation was sent to %{mail_to_invite_email}, but you are signed in as %{link_to_current_user} with email %{mail_to_current_user}." msgid "Note that this invitation was sent to %{mail_to_invite_email}, but you are signed in as %{link_to_current_user} with email %{mail_to_current_user}."
msgstr "" msgstr ""
......
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::ConfigChecker::ExternalDatabaseChecker do
describe '#check' do
subject { described_class.check }
context 'database version is not deprecated' do
before do
allow(described_class).to receive(:db_version_deprecated?).and_return(false)
end
it { is_expected.to be_empty }
end
context 'database version is deprecated' do
before do
allow(described_class).to receive(:db_version_deprecated?).and_return(true)
end
let(:notice_deprecated_database) do
{
type: 'warning',
message: _('Note that PostgreSQL 11 will become the minimum required PostgreSQL version in GitLab 13.0 (May 2020). '\
'PostgreSQL 9.6 and PostgreSQL 10 will no longer be supported in GitLab 13.0. '\
'Please consider upgrading your PostgreSQL version (%{db_version}) soon.') % { db_version: Gitlab::Database.version.to_s }
}
end
it 'reports deprecated database notices' do
is_expected.to contain_exactly(notice_deprecated_database)
end
end
end
describe '#db_version_deprecated' do
subject { described_class.db_version_deprecated? }
context 'database version is not deprecated' do
before do
allow(Gitlab::Database).to receive(:version).and_return(11)
end
it { is_expected.to be false }
end
context 'database version is deprecated' do
before do
allow(Gitlab::Database).to receive(:version).and_return(10)
end
it { is_expected.to be true }
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment