Skip to content

Commit

Permalink
Merge pull request #22626 from Fryguy/fix_migrate_from_plugins
Browse files Browse the repository at this point in the history
Fix migrations being run from a plugin
  • Loading branch information
agrare authored Jul 21, 2023
2 parents b6aef66 + be9c3e6 commit ce5d9f3
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions lib/manageiq/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ def self.manageiq_plugin_update(plugin_root = nil, force_bundle_update: true)
ensure_config_files

unless ENV["CI"]
migrate_database
seed_database
# Update the local development database
create_database(plugin_root)
migrate_database(plugin_root)
seed_database(plugin_root)
end

setup_test_environment(:task_prefix => 'app:', :root => plugin_root) unless ENV["SKIP_TEST_RESET"]
Expand Down Expand Up @@ -96,19 +98,19 @@ def self.bundle_update(root = APP_ROOT, force: false)
puts "===== Begin Gemfile.lock =====\n\n#{lockfile_contents}\n\n===== End Gemfile.lock ====="
end

def self.create_database
puts "\n== Updating database =="
run_rake_task("db:create")
def self.create_database(root = APP_ROOT)
puts "\n== Creating database =="
run_rake_task("db:create", :root => root)
end

def self.migrate_database
def self.migrate_database(root = APP_ROOT)
puts "\n== Migrating database =="
run_rake_task("db:migrate")
run_rake_task("db:migrate", :root => root)
end

def self.seed_database
def self.seed_database(root = APP_ROOT)
puts "\n== Seeding database =="
run_rake_task("db:seed")
run_rake_task("db:seed", :root => root)
end

def self.setup_test_environment(task_prefix: '', root: APP_ROOT)
Expand Down

0 comments on commit ce5d9f3

Please sign in to comment.