Welcome to mirror list, hosted at ThFree Co, Russian Federation.

database_config.rb « patch « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 20d8f7be8fd43ca4beaa5c4c8695126e5870957b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

# The purpose of this code is to set the migrations path
# for the Geo tracking database.
module Gitlab
  module Patch
    module DatabaseConfig
      extend ActiveSupport::Concern

      def database_configuration
        super.to_h do |env, configs|
          if Gitlab.ee?
            if configs.key?("geo")
              migrations_paths = Array(configs["geo"]["migrations_paths"])
              migrations_paths << "ee/db/geo/migrate" if migrations_paths.empty?
              migrations_paths << "ee/db/geo/post_migrate" unless ENV['SKIP_POST_DEPLOYMENT_MIGRATIONS']

              configs["geo"]["migrations_paths"] = migrations_paths.uniq
              configs["geo"]["schema_migrations_path"] = "ee/db/geo/schema_migrations" if configs["geo"]["schema_migrations_path"].blank?
            end
          end

          [env, configs]
        end
      end
    end
  end
end