Problem
# config/allgood.rb
Database.find_each do |database|
check "#{database.name} has a daily DB backup" do
expect(database.last_backup_finished_at).to_be_greater_than(1.day.ago)
end
end
breaks the db setup (using bundle exec rails db:create), since there is no access to the DB at this point. I fixed it with a rescue block for the moment:
# config/allgood.rb
begin
if Database.table_exists?
Database.enabled.order(name: :asc).find_each do |database|
check "#{database.name} has a daily DB backup" do
expect(database.last_backup_finished_at).to_be_greater_than(1.day.ago)
end
end
end
rescue ActiveRecord::NoDatabaseError, ActiveRecord::ConnectionNotEstablished
# Skip checks during setup
end
Do you have an idea how I could improve this?
Ideas
Problem
breaks the db setup (using
bundle exec rails db:create), since there is no access to the DB at this point. I fixed it with a rescue block for the moment:Do you have an idea how I could improve this?
Ideas