From 2dd6da7a3a8c1cef02e50f8ae69e3a72c4dc71f1 Mon Sep 17 00:00:00 2001 From: Stephen MacVicar Date: Tue, 28 May 2024 13:17:30 -0400 Subject: [PATCH] FI-2765: Automatically run migrations (#496) --- lib/inferno/apps/cli/main.rb | 2 ++ lib/inferno/apps/cli/migration.rb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/inferno/apps/cli/main.rb b/lib/inferno/apps/cli/main.rb index a09477309..c4df15e97 100644 --- a/lib/inferno/apps/cli/main.rb +++ b/lib/inferno/apps/cli/main.rb @@ -11,6 +11,7 @@ module CLI class Main < Thor desc 'console', 'Start an interactive console session with Inferno' def console + Migration.new.run(Logger::INFO) Console.new.run end @@ -25,6 +26,7 @@ def migrate type: :boolean, desc: 'Automatically restart Inferno when a file is changed.' def start + Migration.new.run(Logger::INFO) command = 'foreman start --env=/dev/null' if `gem list -i foreman`.chomp == 'false' puts "You must install foreman with 'gem install foreman' prior to running Inferno." diff --git a/lib/inferno/apps/cli/migration.rb b/lib/inferno/apps/cli/migration.rb index 81dc4e26a..b4094f2fd 100644 --- a/lib/inferno/apps/cli/migration.rb +++ b/lib/inferno/apps/cli/migration.rb @@ -3,9 +3,9 @@ module Inferno module CLI class Migration - def run + def run(log_level = Logger::DEBUG) Inferno::Application.start(:logging) - Inferno::Application['logger'].level = Logger::DEBUG + Inferno::Application['logger'].level = log_level Utils::Migration.new.run end