diff options
author | Joshua Nichols <josh@technicalpickles.com> | 2009-08-08 17:19:47 -0400 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-08-09 20:18:56 -0700 |
commit | 84d24cdae8269a161d36e00009c043bbd102cbbd (patch) | |
tree | beee75c60ecfb3952c920b3e9f400daf55f2ff93 | |
parent | 279b785839d87aac9caf46c261595fc0965d85a2 (diff) | |
download | rails-84d24cdae8269a161d36e00009c043bbd102cbbd.tar.gz rails-84d24cdae8269a161d36e00009c043bbd102cbbd.tar.bz2 rails-84d24cdae8269a161d36e00009c043bbd102cbbd.zip |
Only load db/schema.rb if it exists; otherwise, display a message to run db:migrate or remove active_record in environment.rb.
[#3012 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
-rw-r--r-- | 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 b82341ba94..687bc00b3c 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. If you do not intend to use a database, you should instead alter #{RAILS_ROOT}/config/environment.rb to prevent active_record from loading: config.frameworks -= [ :active_record ]} + end end end |