mirror of
https://github.com/publiclab/mapknitter.git
synced 2026-04-10 13:49:00 +02:00
* Fixes #1680 Correcting console messages and errors in rake tasks #1680 * Fixes #1680 Correcting console messages and errors in rake tasks #1680
20 lines
434 B
Ruby
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
|