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
|
|
|
|
# for the Geo tracking 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?
|
|
|
|
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']
|
2022-01-26 12:08:38 +05:30
|
|
|
|
2022-06-21 17:19:12 +05:30
|
|
|
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
|
2022-01-26 12:08:38 +05:30
|
|
|
end
|
|
|
|
|
2021-11-11 11:23:49 +05:30
|
|
|
[env, configs]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|