debian-mirror-gitlab/lib/gitlab/config_checker/external_database_checker.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
1.4 KiB
Ruby
Raw Normal View History

2020-05-24 23:13:21 +05:30
# frozen_string_literal: true
module Gitlab
module ConfigChecker
module ExternalDatabaseChecker
extend self
2022-11-25 23:54:43 +05:30
PG_REQUIREMENTS_LINK =
'<a href="https://docs.gitlab.com/ee/install/requirements.html#database">database requirements</a>'
2020-05-24 23:13:21 +05:30
def check
2023-01-13 00:05:48 +05:30
unsupported_databases = Gitlab::Database
2022-11-25 23:54:43 +05:30
.database_base_models
2023-01-13 00:05:48 +05:30
.each_with_object({}) do |(database_name, base_model), databases|
database = Gitlab::Database::Reflection.new(base_model)
2020-07-28 23:09:34 +05:30
2023-01-13 00:05:48 +05:30
databases[database_name] = database unless database.postgresql_minimum_supported_version?
end
unsupported_databases.map do |database_name, database|
2020-10-24 23:57:45 +05:30
{
type: 'warning',
2023-01-13 00:05:48 +05:30
message: _('Database \'%{database_name}\' is using PostgreSQL %{pg_version_current}, ' \
'but PostgreSQL %{pg_version_minimum} is required for this version of GitLab. ' \
2020-10-24 23:57:45 +05:30
'Please upgrade your environment to a supported PostgreSQL version, ' \
2022-11-25 23:54:43 +05:30
'see %{pg_requirements_url} for details.') % \
{
2023-01-13 00:05:48 +05:30
database_name: database_name,
2022-11-25 23:54:43 +05:30
pg_version_current: database.version,
pg_version_minimum: Gitlab::Database::MINIMUM_POSTGRES_VERSION,
pg_requirements_url: PG_REQUIREMENTS_LINK
}
2020-10-24 23:57:45 +05:30
}
2022-11-25 23:54:43 +05:30
end
2020-05-24 23:13:21 +05:30
end
end
end
end