
db:test:prepare should not call db:create.
Reported by Postmodern | June 17th, 2010 @ 08:54 PM
The standard Rails db:test:prepare
does not call
db:create
, but instead calls
db:abort_if_pending_migrations
to make sure the
Database is up to date. By having dm-rails
db:test:prepare
call db:create
everytime
is rather annoying, as it creates both the testing and development
repositories; when we only care about the testing database.
Rails:
$ rake db:test:prepare --trace
(in /home/hal/rails_ar)
** 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
dm-rails:
** Invoke db:test:prepare (first_time)
** Invoke db:setup (first_time)
** Invoke db:create (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:create
Comments and changes to this ticket
-
Martin Gamsjaeger (snusnu) August 10th, 2010 @ 05:51 PM
- State changed from new to unconfirmed
- Milestone order changed from 0 to 0
I guess we still want/need to do something about that?
-
matth August 13th, 2010 @ 08:03 AM
Yes please!
A quick fix without breaking all of the existing functionality ...
namespace :test do
Rails.env = 'test' if ENV['RAILS_ENV'].nil? task :prepare => ['db:setup']
end
Or even better maybe ...
namespace :test do
Rails.env = 'test' if ENV['RAILS_ENV'].nil? task :prepare => ['db:autoupgrade']
end
-
Martin Gamsjaeger (snusnu) September 13th, 2010 @ 06:47 PM
- State changed from unconfirmed to resolved
This is "fixed" in two ways now.
First, we don't operate on
development
andtest
environments anymore, if the current env isdevelopment
. Thedb:create
task only creates the database(s) in the currently specified environment.Second,
db:test:prepare
is a noop now. It could/should probably perform the same check as AR, namely checking if there are pending migrations, but that's not currently implemented and a separate ticket should be filed if it turns out that we want this behavior.The relevant commits are:
http://github.com/datamapper/dm-rails/commit/0a196c4ef9d61b1fbc2c6c...
http://github.com/datamapper/dm-rails/commit/376cb665feab07b9959f70...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »