about summary refs log tree commit diff
path: root/lib/tasks/db.rake
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tasks/db.rake')
-rw-r--r--lib/tasks/db.rake5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake
index a1211f097..7a055bf25 100644
--- a/lib/tasks/db.rake
+++ b/lib/tasks/db.rake
@@ -5,7 +5,10 @@ namespace :db do
     desc 'Setup the db or migrate depending on state of db'
     task setup: :environment do
       begin
-        ActiveRecord::Base.connection
+        if ActiveRecord::Migrator.current_version.zero?
+          Rake::Task['db:migrate'].invoke
+          Rake::Task['db:seed'].invoke
+        end
       rescue ActiveRecord::NoDatabaseError
         Rake::Task['db:setup'].invoke
       else