diff options
Diffstat (limited to 'lib/gitlab/patch/database_config.rb')
-rw-r--r-- | lib/gitlab/patch/database_config.rb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/gitlab/patch/database_config.rb b/lib/gitlab/patch/database_config.rb index 20d8f7be8fd..8a7566f6e0e 100644 --- a/lib/gitlab/patch/database_config.rb +++ b/lib/gitlab/patch/database_config.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # The purpose of this code is to set the migrations path -# for the Geo tracking database. +# for the Geo tracking database and the embedding database. module Gitlab module Patch module DatabaseConfig @@ -10,13 +10,17 @@ module Gitlab 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'] + ee_databases = %w[embedding geo] - configs["geo"]["migrations_paths"] = migrations_paths.uniq - configs["geo"]["schema_migrations_path"] = "ee/db/geo/schema_migrations" if configs["geo"]["schema_migrations_path"].blank? + 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 |