From f976ea6524dff800443e8d20e78f6c3fcbae51d1 Mon Sep 17 00:00:00 2001 From: Vinicius Stock Date: Wed, 30 Oct 2024 11:38:53 -0400 Subject: [PATCH] Do not reload rake tasks when under add-on environment Co-authored-by: Andy Waite --- lib/tapioca/dsl/pipeline.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/tapioca/dsl/pipeline.rb b/lib/tapioca/dsl/pipeline.rb index 90360a0ef..1a9594241 100644 --- a/lib/tapioca/dsl/pipeline.rb +++ b/lib/tapioca/dsl/pipeline.rb @@ -225,9 +225,14 @@ def report_error(error) sig { void } def abort_if_pending_migrations! + # When running within the add-on, we cannot invoke the abort if pending migrations task because that will exit + # the process and crash the Rails runtime server. Instead, the Rails add-on checks for pending migrations and + # warns the user, so that they are aware they need to migrate their database + return if @lsp_addon return unless defined?(::Rake) Rails.application.load_tasks + if Rake::Task.task_defined?("db:abort_if_pending_migrations") Rake::Task["db:abort_if_pending_migrations"].invoke end