Put database.yml into the code base
It works by default, we have a mechanism to configure it (dotenv.example) and we want to be a 12factor app, right? Let's do this...
This commit is contained in:
parent
a0b79c7789
commit
f8b7233404
8 changed files with 22 additions and 55 deletions
18
lib/tasks/db.rake
Normal file
18
lib/tasks/db.rake
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
namespace :db do
|
||||
desc 'Bootstrap the database for the current RAILS_ENV (create, setup & seed if the database does not exist)'
|
||||
task bootstrap: :environment do
|
||||
puts 'Bootstrapping the database...'
|
||||
begin
|
||||
# Only do this if the database does not exist...
|
||||
Rake::Task['db:version'].invoke
|
||||
# rubocop:disable Style/RescueStandardError
|
||||
rescue
|
||||
# rubocop:enable Style/RescueStandardError
|
||||
Rake::Task['db:create'].invoke
|
||||
Rake::Task['db:setup'].invoke
|
||||
Rake::Task['db:seed'].invoke
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue