From 02f0fb078c3fe2dd22cafa379fb6da8426cc06d8 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Wed, 20 Feb 2019 17:20:46 +0100 Subject: [PATCH] Fix database setup in dev-env 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. --- lib/tasks/db.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index 8e5c382f..39db898f 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -3,9 +3,9 @@ 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:create'].invoke Rake::Task['db:setup'].invoke Rake::Task['db:seed'].invoke else