diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 16:49:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 16:49:51 +0300 |
commit | 71786ddc8e28fbd3cb3fcc4b3ff15e5962a1c82e (patch) | |
tree | 6a2d93ef3fb2d353bb7739e4b57e6541f51cdd71 /scripts/db_tasks | |
parent | a7253423e3403b8c08f8a161e5937e1488f5f407 (diff) |
Add latest changes from gitlab-org/gitlab@15-9-stable-eev15.9.0-rc42
Diffstat (limited to 'scripts/db_tasks')
-rwxr-xr-x | scripts/db_tasks | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/scripts/db_tasks b/scripts/db_tasks index 56c2eefef68..36040877abf 100755 --- a/scripts/db_tasks +++ b/scripts/db_tasks @@ -1,12 +1,17 @@ -#!/bin/bash +#!/usr/bin/env ruby +# frozen_string_literal: true -root_path="$(cd "$(dirname "$0")/.." || exit ; pwd -P)" -task=$1 +require 'yaml' -shift +rails_env = ENV.fetch('RAILS_ENV') +database_config = YAML.load_file(File.join(File.expand_path('..', __dir__), 'config', 'database.yml'))[rails_env] -if [[ -d "${root_path}/ee/" || "${DECOMPOSED_DB}" == "true" ]]; then - task="${task}:main" -fi +task = ARGV.shift +raise ArgumentError, 'You need to pass a task name!' unless task -eval "bundle exec rake ${task} ${*}" +task = "#{task}:main" unless database_config.one? +cmd = ['bundle', 'exec', 'rake', task, *ARGV] + +puts "Running: `#{cmd.join(' ')}`" + +system(*cmd) |