A platform for community discussion. Free, open, simple.
DEV: Add rake task to check that the DB can be accessed (#14300)
Daniel Waterworth05c356f7c6fd
diff --git a/lib/tasks/db.rake b/lib/tasks/db.rakeindex 9f3c6fc7f97..3230357df38 100644--- a/lib/tasks/db.rake+++ b/lib/tasks/db.rake@@ -545,3 +545,15 @@ task 'db:rebuild_indexes' => 'environment' doDiscourse.disable_readonly_modeendend++desc 'Check that the DB can be accessed'+task 'db:status:json' do+ begin+ Rake::Task['environment'].invoke+ DB.query('SELECT 1')+ rescue+ puts({ status: 'error' }.to_json)+ else+ puts({ status: 'ok' }.to_json)+ end+end