Skip to content

Commit

Permalink
Rescue NoDatabaseError
Browse files Browse the repository at this point in the history
At the moment with the new app we are running it is not possible to run db:create because Gouda wants to use the DB before there is a DB.
  • Loading branch information
julik committed Jun 11, 2024
1 parent 9c5f566 commit 2ae305e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/gouda/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,15 @@ class Railtie < Rails::Railtie
end

Gouda::Scheduler.build_scheduler_entries_list!
Gouda::Scheduler.upsert_workloads_from_entries_list!
begin
Gouda::Scheduler.upsert_workloads_from_entries_list!
rescue ActiveRecord::NoDatabaseError
# Do nothing. On a freshly checked-out Rails app, running even unrelated Rails tasks
# (such as asset compilation) - or, more importantly, initial db:create -
# will cause a NoDatabaseError, as this is a chicken-and-egg problem. That error
# is safe to ignore in this instance - we should let the outer task proceed,
# because if there is no database we should allow it to get created.
end
end
end
end

0 comments on commit 2ae305e

Please sign in to comment.