From 05a672f5d4dc7e96ddd02928d0e69295de80d488 Mon Sep 17 00:00:00 2001 From: Joshua Nichols Date: Sat, 8 Aug 2009 17:19:47 -0400 Subject: [PATCH] Only load db/schema.rb if it exists, otherwise display a message to run db:migrate. [#3012] --- railties/lib/tasks/databases.rake | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/railties/lib/tasks/databases.rake b/railties/lib/tasks/databases.rake index 23a3a73..4ccc0b9 100644 --- a/railties/lib/tasks/databases.rake +++ b/railties/lib/tasks/databases.rake @@ -292,7 +292,11 @@ namespace :db do desc "Load a schema.rb file into the database" task :load => :environment do file = ENV['SCHEMA'] || "#{RAILS_ROOT}/db/schema.rb" - load(file) + if File.exists?(file) + load(file) + else + abort %{#{file} doesn't exist yet. Run "rake db:migrate" to create it then try again.} + end end end -- 1.6.4