Module: Gitlab::Patch::DatabaseConfig

Extended by:
ActiveSupport::Concern
Defined in:
lib/gitlab/patch/database_config.rb

Instance Method Summary collapse

Instance Method Details

#database_configurationObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/gitlab/patch/database_config.rb', line 10

def database_configuration
  super.to_h do |env, configs|
    if Gitlab.ee?
      ee_databases = %w[embedding geo]

      ee_databases.each do |ee_db_name|
        next unless configs.key?(ee_db_name)

        migrations_paths = Array(configs[ee_db_name]['migrations_paths'])
        migrations_paths << File.join('ee', 'db', ee_db_name, 'migrate') if migrations_paths.empty?
        migrations_paths << File.join('ee', 'db', ee_db_name, 'post_migrate') unless ENV['SKIP_POST_DEPLOYMENT_MIGRATIONS']

        configs[ee_db_name]['migrations_paths'] = migrations_paths.uniq
        configs[ee_db_name]['schema_migrations_path'] = File.join('ee', 'db', ee_db_name, 'schema_migrations') if configs[ee_db_name]['schema_migrations_path'].blank?
      end
    end

    [env, configs]
  end
end