Peter Vandenabeele
2011-Feb-17 20:53 UTC
rake db:create (in development mode) creates development _and_ test database
This behaviour seems strange to me: Rails 3.0.4 $ rake db:create # => creates project_dev AND project_test databases $ rake db:drop # => only drops the project_dev database (as expected) $ RAILS_ENV=test rake db:drop # => this effectively drops the project_test database (as expected) Seems in conflict with this description: $ rake -T db:create rake db:create # Create the database from config/database.yml for the current Rails.env (use db:create:all to create all dbs i... $ rake -T db:drop rake db:drop # Drops the database for the current Rails.env (use db:drop:all to drop all databases) If this is not the intended behaviour, I can submit a bug report in rails-core and probably work up a patch too. Catting my Gemfile here (just did bundle update with this): $ cat Gemfile source ''http://rubygems.org'' gem ''rails'', ''3.0.4'' gem ''pg'', ''0.10.1'' gem ''capistrano'' gem ''openminds_deploy'' group :development, :test do gem ''rspec-rails'', ''>= 2.0.0'' gem ''cucumber-rails'', ''>= 0.3.2'' gem ''webrat'', ''>= 0.7.2'' gem ''autotest'' end HTH, Peter -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Jan
2011-Feb-18 02:11 UTC
Re: rake db:create (in development mode) creates development _and_ test database
I guess the document for db:create need to be updated:
# activerecord/lib/active_record/railties/databases.rake#36
desc ''Create the database from config/database.yml for the current
Rails.env (use db:create:all to create all dbs in the config)''
task :create => :load_config do
# Make the test database at the same time as the development one, if it
exists
if Rails.env.development? &&
ActiveRecord::Base.configurations[''test'']
create_database(ActiveRecord::Base.configurations[''test''])
end
create_database(ActiveRecord::Base.configurations[Rails.env])
end
On Fri, Feb 18, 2011 at 4:53 AM, Peter Vandenabeele
<lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:
> This behaviour seems strange to me:
>
> Rails 3.0.4
>
> $ rake db:create
> # => creates project_dev AND project_test databases
>
> $ rake db:drop
> # => only drops the project_dev database (as expected)
>
> $ RAILS_ENV=test rake db:drop
> # => this effectively drops the project_test database (as expected)
>
> Seems in conflict with this description:
>
> $ rake -T db:create
> rake db:create # Create the database from config/database.yml for the
> current Rails.env
> (use db:create:all to create all dbs i...
>
> $ rake -T db:drop
> rake db:drop # Drops the database for the current Rails.env
> (use db:drop:all to drop all databases)
>
> If this is not the intended behaviour, I can submit a bug report in
> rails-core and probably work up a patch too. Catting my Gemfile here
> (just did bundle update with this):
>
> $ cat Gemfile
> source ''http://rubygems.org''
>
> gem ''rails'', ''3.0.4''
> gem ''pg'', ''0.10.1''
> gem ''capistrano''
> gem ''openminds_deploy''
>
> group :development, :test do
> gem ''rspec-rails'', ''>= 2.0.0''
> gem ''cucumber-rails'', ''>= 0.3.2''
> gem ''webrat'', ''>= 0.7.2''
> gem ''autotest''
> end
>
> HTH,
>
> Peter
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.