DEV: Add rake task to check that the DB can be accessed (#14300)
This commit is contained in:
parent
789613fe51
commit
05c356f7c6
|
@ -545,3 +545,15 @@ task 'db:rebuild_indexes' => 'environment' do
|
||||||
Discourse.disable_readonly_mode
|
Discourse.disable_readonly_mode
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
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
|
||||||
|
|
Loading…
Reference in New Issue