mirror of
https://github.com/openSUSE/osem.git
synced 2026-01-24 13:58:56 -05:00
The postgres image does not come with pre-configured osem databases per environment. Calling db:create doesn't hurt if the databases already exist, so let's do it every time we bootstrap.
16 lines
473 B
Ruby
16 lines
473 B
Ruby
# 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
|
|
Rake::Task['db:create'].invoke
|
|
if ActiveRecord::Base.connection.tables.empty?
|
|
puts 'Bootstrapping the database...'
|
|
Rake::Task['db:setup'].invoke
|
|
Rake::Task['db:seed'].invoke
|
|
else
|
|
puts 'Database exists, skipping bootstrap...'
|
|
end
|
|
end
|
|
end
|