This project is archived and is in readonly mode.
test tasks fail when db/schema.rb doesn't exist
Reported by Josh Nichols | August 8th, 2009 @ 09:56 PM | in 2.3.4
Check this:
$ rails zomg-no-db
$ cd zomg-no-db
$ rake --trace test
(in /Users/nichoj/code/experimental/zomg-no-db)
** Invoke test (first_time)
** Execute test
** Invoke test:units (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment
** Execute db:test:purge
** Execute db:test:load
** Invoke db:schema:load (first_time)
** Invoke environment
** Execute db:schema:load
rake aborted!
no such file to load -- /Users/nichoj/code/experimental/zomg-no-db/db/schema.rb
/gentoo/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:145:in `load_without_new_constant_marking'
/gentoo/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:145:in `load'
/gentoo/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:521:in `new_constants_in'
/gentoo/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:145:in `load'
/gentoo/usr/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/tasks/databases.rake:259
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/gentoo/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/gentoo/usr/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/tasks/databases.rake:304
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/gentoo/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/gentoo/usr/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/tasks/databases.rake:378
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/gentoo/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/gentoo/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/gentoo/usr/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/tasks/testing.rake:45
/gentoo/usr/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/tasks/testing.rake:43:in `collect'
/gentoo/usr/lib/ruby/gems/1.8/gems/rails-2.3.3/lib/tasks/testing.rake:43
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/gentoo/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/gentoo/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/gentoo/usr/bin/rake18:19:in `load'
/gentoo/usr/bin/rake18:19
You can get around this by running rake db:create
db:migrate
, but a more friendly error message should be
possible.
Comments and changes to this ticket
-
Rizwan Reza August 8th, 2009 @ 10:00 PM
- Tag set to bugmash, error, verified
verified
+1 Agreed. That is sure to scare a beginner. :)
-
Josh Nichols August 8th, 2009 @ 10:46 PM
Chrome has failed me for the last time for attaching a patch.
No tests, because there's no previous tests for rake stuff.
-
Dan Croak August 8th, 2009 @ 10:49 PM
+1 verified patch applies cleanly. Looks like the right error message now.
-
John Trupiano August 9th, 2009 @ 04:08 PM
+1 verified patch applies cleanly, addresses something I think should be fixed.
It's worth pointing out that rails can be used without a database. Would it make sense to change the error message from:
db/schema.rb doesn't exist yet. Run "rake db:migrate" to create it then try again.
to
db/schema.rb 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 config/environment.rb to remove active_record: config.frameworks -= [ :active_record ]
I've attached a revised patch for consideration.
-
Rizwan Reza August 9th, 2009 @ 04:14 PM
verified
+1 The patch applies cleanly to master and 2-3-stable.
-
Nikolay Petrachkov August 9th, 2009 @ 04:21 PM
- Assigned user set to Pratik
- Tag changed from bugmash, error, verified to bugmash, error, patch, verified
+1 Patch works for 2-3.
-
Elad Meidar August 9th, 2009 @ 05:22 PM
+1 on idea and message, verified and applies cleanly on 2-3-stable and master
sidenote: there should be a test suit for the basic included rake tasks, there are tests.
-
Josh Nichols August 9th, 2009 @ 05:34 PM
+1 on John's message tweaks. I had thought to include a message to that effect, but figured it'd be a little too verbose. Looks fine though.
-
David Trasbo August 9th, 2009 @ 07:34 PM
+1
Applies cleanly to edge Rails. But the patch needs tests.
-
Josh Nichols August 9th, 2009 @ 08:14 PM
As I said before, there aren't any tests for ANY of the rake tasks, so starting to do that just for this one patch seems a little overwhelming.
-
Derander August 9th, 2009 @ 08:22 PM
- Assigned user cleared.
+1
I frequently write rails apps with no database.
Patch applied cleanly to 2-3-stable and master.
-
Derander August 9th, 2009 @ 08:22 PM
- Assigned user set to Pratik
Oops, apparently I cleared the assigned user. That wasn't intentional.. undoing that.
-
Rebecca Frankel August 10th, 2009 @ 03:30 AM
+1 Yes, I really want this fix. I want to be reminded what to do rather than get a long stack trace that is always the same. Could there be analogous fixes for the perennial stack traces that result from not having some needed gem installed?
patch applied to 2-3-stable. I ran the tests too, not that it makes a difference for a patch without tests.
-
Repository August 10th, 2009 @ 04:19 AM
- State changed from new to committed
(from [84d24cdae8269a161d36e00009c043bbd102cbbd]) 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
http://github.com/rails/rails/commit/84d24cdae8269a161d36e00009c043... -
Repository August 10th, 2009 @ 04:19 AM
(from [ebb6606a4d09ca362a0c56a458444a8dd551c495]) 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
http://github.com/rails/rails/commit/ebb6606a4d09ca362a0c56a458444a... -
Jeremy Kemper August 10th, 2009 @ 04:20 AM
- Tag changed from bugmash, error, patch, verified to error, patch, verified
- Milestone set to 2.3.4
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 3012 test tasks fail when db/schema.rb doesn't exist [#3012 state:committed]
- 3012 test tasks fail when db/schema.rb doesn't exist [#3012 state:committed]