Files
mapknitter/lib/tasks/db.rake
Jong-Won Lee 650ced297a Correct console messages and errors in rake tasks (#1681)
* Fixes #1680

Correcting console messages and errors in rake tasks #1680

* Fixes #1680

Correcting console messages and errors in rake tasks #1680
2022-05-05 00:06:13 +03:00

20 lines
434 B
Ruby

# frozen_string_literal: true
namespace :db do
desc "Checks whether the database exists or not"
task :exists do
begin
# Tries to initialize the application.
# It will fail if the database does not exist
Rake::Task["environment"].invoke
ActiveRecord::Base.connection
puts "There is a database"
rescue StandardError
puts "There is no database"
exit 1
else
exit 0
end
end
end