debian-mirror-gitlab/lib/gitlab/patch/database_config.rb

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

33 lines
1.1 KiB
Ruby
Raw Normal View History

2021-11-11 11:23:49 +05:30
# frozen_string_literal: true
2022-07-23 23:45:48 +05:30
# The purpose of this code is to set the migrations path
2023-07-09 08:55:56 +05:30
# for the Geo tracking database and the embedding database.
2021-11-11 11:23:49 +05:30
module Gitlab
module Patch
2022-06-21 17:19:12 +05:30
module DatabaseConfig
2021-11-11 11:23:49 +05:30
extend ActiveSupport::Concern
def database_configuration
super.to_h do |env, configs|
2022-06-21 17:19:12 +05:30
if Gitlab.ee?
2023-07-09 08:55:56 +05:30
ee_databases = %w[embedding geo]
2022-01-26 12:08:38 +05:30
2023-07-09 08:55:56 +05:30
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?
2022-06-21 17:19:12 +05:30
end
2022-01-26 12:08:38 +05:30
end
2021-11-11 11:23:49 +05:30
[env, configs]
end
end
end
end
end