Module: Gitlab::DatabaseWarnings

Defined in:
lib/gitlab/database_warnings.rb

Class Method Summary collapse

Class Method Details

.check_postgres_version_and_print_warningObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/gitlab/database_warnings.rb', line 5

def self.check_postgres_version_and_print_warning
  return if Gitlab::Runtime.rails_runner?

  Gitlab::Database.database_base_models.each do |name, model|
    database = Gitlab::Database::Reflection.new(model)

    next if database.postgresql_minimum_supported_version?

    Kernel.warn ERB.new(Rainbow.new.wrap("\n                \u2588\u2588\u2001    \u2588\u2588\u2001 \u2588\u2588\u2588\u2588\u2588\u2001 \u2588\u2588\u2588\u2588\u2588\u2588\u2001 \u2588\u2588\u2588\u2001   \u2588\u2588\u2001\u2588\u2588\u2001\u2588\u2588\u2588\u2001   \u2588\u2588\u2001 \u2588\u2588\u2588\u2588\u2588\u2588\n                \u2588\u2588\u2001    \u2588\u2588\u2001\u2588\u2588\u2001\u2001\u2001\u2588\u2588\u2001\u2588\u2588\u2001\u2001\u2001\u2588\u2588\u2001\u2588\u2588\u2588\u2588\u2001  \u2588\u2588\u2001\u2588\u2588\u2001\u2588\u2588\u2588\u2588\u2001  \u2588\u2588\u2001\u2588\u2588\n                \u2588\u2588\u2001 \u2588\u2001 \u2588\u2588\u2001\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2001\u2588\u2588\u2588\u2588\u2588\u2588\u2001\u2001\u2588\u2588\u2001\u2588\u2588\u2001 \u2588\u2588\u2001\u2588\u2588\u2001\u2588\u2588\u2001\u2588\u2588\u2001 \u2588\u2588\u2001\u2588\u2588\u2001  \u2588\u2588\u2588\n                \u2588\u2588\u2001\u2588\u2588\u2588\u2001\u2588\u2588\u2001\u2588\u2588\u2001\u2001\u2001\u2588\u2588\u2001\u2588\u2588\u2001\u2001\u2001\u2588\u2588\u2001\u2588\u2588\u2001\u2001\u2588\u2588\u2001\u2588\u2588\u2001\u2588\u2588\u2001\u2588\u2588\u2001\u2001\u2588\u2588\u2001\u2588\u2588\u2001\u2588\u2588\u2001   \u2588\u2588\n                \u2001\u2588\u2588\u2588\u2001\u2588\u2588\u2588\u2001\u2001\u2588\u2588\u2001  \u2588\u2588\u2001\u2588\u2588\u2001  \u2588\u2588\u2001\u2588\u2588\u2001 \u2001\u2588\u2588\u2588\u2588\u2001\u2588\u2588\u2001\u2588\u2588\u2001 \u2001\u2588\u2588\u2588\u2588\u2001\u2001\u2588\u2588\u2588\u2588\u2588\u2588\n\n      ******************************************************************************\n        You are using PostgreSQL \#{database.version} for the \#{name} database, but this version of GitLab requires PostgreSQL >= <%= Gitlab::Database::MINIMUM_POSTGRES_VERSION %>.\n        <% if Rails.env.development? || Rails.env.test? %>\n        If using gitlab-development-kit, please find the relevant steps here:\n          https://gitlab-org.gitlab.io/gitlab-development-kit/howto/postgresql/#upgrade-postgresql\n        <% end %>\n        Please upgrade your environment to a supported PostgreSQL version. See\n        https://docs.gitlab.com/ee/install/requirements.html#database for details.\n      ******************************************************************************\n    WARNING\n  rescue ActiveRecord::ActiveRecordError, PG::Error\n    # ignore - happens when Rake tasks yet have to create a database, e.g. for testing\n  end\nend\n").red).result

.check_single_connection_and_print_warningObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/gitlab/database_warnings.rb', line 36

def self.check_single_connection_and_print_warning
  return if Gitlab::Runtime.rails_runner?
  return unless Gitlab::Database.database_mode == Gitlab::Database::MODE_SINGLE_DATABASE

  Kernel.warn ERB.new(Rainbow.new.wrap("\n              \u2588\u2588\u2001    \u2588\u2588\u2001 \u2588\u2588\u2588\u2588\u2588\u2001 \u2588\u2588\u2588\u2588\u2588\u2588\u2001 \u2588\u2588\u2588\u2001   \u2588\u2588\u2001\u2588\u2588\u2001\u2588\u2588\u2588\u2001   \u2588\u2588\u2001 \u2588\u2588\u2588\u2588\u2588\u2588\n              \u2588\u2588\u2001    \u2588\u2588\u2001\u2588\u2588\u2001\u2001\u2001\u2588\u2588\u2001\u2588\u2588\u2001\u2001\u2001\u2588\u2588\u2001\u2588\u2588\u2588\u2588\u2001  \u2588\u2588\u2001\u2588\u2588\u2001\u2588\u2588\u2588\u2588\u2001  \u2588\u2588\u2001\u2588\u2588\n              \u2588\u2588\u2001 \u2588\u2001 \u2588\u2588\u2001\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2001\u2588\u2588\u2588\u2588\u2588\u2588\u2001\u2001\u2588\u2588\u2001\u2588\u2588\u2001 \u2588\u2588\u2001\u2588\u2588\u2001\u2588\u2588\u2001\u2588\u2588\u2001 \u2588\u2588\u2001\u2588\u2588\u2001  \u2588\u2588\u2588\n              \u2588\u2588\u2001\u2588\u2588\u2588\u2001\u2588\u2588\u2001\u2588\u2588\u2001\u2001\u2001\u2588\u2588\u2001\u2588\u2588\u2001\u2001\u2001\u2588\u2588\u2001\u2588\u2588\u2001\u2001\u2588\u2588\u2001\u2588\u2588\u2001\u2588\u2588\u2001\u2588\u2588\u2001\u2001\u2588\u2588\u2001\u2588\u2588\u2001\u2588\u2588\u2001   \u2588\u2588\n              \u2001\u2588\u2588\u2588\u2001\u2588\u2588\u2588\u2001\u2001\u2588\u2588\u2001  \u2588\u2588\u2001\u2588\u2588\u2001  \u2588\u2588\u2001\u2588\u2588\u2001 \u2001\u2588\u2588\u2588\u2588\u2001\u2588\u2588\u2001\u2588\u2588\u2001 \u2001\u2588\u2588\u2588\u2588\u2001\u2001\u2588\u2588\u2588\u2588\u2588\u2588\n\n    ******************************************************************************\n      Your database has a single connection, and single connections were\n      deprecated in GitLab 15.9 https://docs.gitlab.com/ee/update/deprecations.html#single-database-connection-is-deprecated.\n\n      In GitLab 17.0 and later, you must have the two main: and ci: sections in your database.yml.\n\n      Please add a :ci section to your database, following these instructions:\n      https://docs.gitlab.com/ee/install/installation.html#configure-gitlab-db-settings.\n    ******************************************************************************\n  WARNING\nend\n").red).result