This project is archived and is in readonly mode.
[PATCH] rake db:create creates development db only
Reported by Santiago Pastorino | March 8th, 2010 @ 01:48 AM | in 3.0.2
Perhaps we should use rake db:create:all to create all the databases or rake db:create RAILS_ENV=test to create only test
Comments and changes to this ticket
-
Mikel Lindsaar March 9th, 2010 @ 02:35 AM
What problem are you trying to solve here?
Ie, how does the current system cause you problems?
This is the usual flow for most people who are testing:
$ rails g migration ... $ rake db:migrate $ rake test
Which promptly blows up -> no test database.
Mikel
-
Santiago Pastorino March 9th, 2010 @ 10:22 AM
I'm trying to have rake db:create to not create test database.
I think that should be the right way and the least surprise for users. -
Santiago Pastorino March 9th, 2010 @ 11:31 AM
santiago@debian:/tmp/test_app$ ls db/
seeds.rb
santiago@debian:/tmp/test_app$ rake db:create
(in /tmp/test_app) santiago@debian:/tmp/test_app$ ls db/
development.sqlite3 seeds.rb test.sqlite3
santiago@debian:/tmp/test_app$ rake db:drop
(in /tmp/test_app) santiago@debian:/tmp/test_app$ ls db/
seeds.rb test.sqlite3
santiago@debian:/tmp/test_app$ rake db:drop RAILS_ENV=test
(in /tmp/test_app) santiago@debian:/tmp/test_app$ ls db/
seeds.rb -
Santiago Pastorino March 9th, 2010 @ 06:16 PM
- State changed from open to wontfix
I understand now what you do Mikel, thanks
-
Jeremy Kemper March 9th, 2010 @ 06:25 PM
This is because db:reset and db:setup tasks depend on it, and it's convenient to have test db created along with dev.
-
viktor tron (strawberry) January 12th, 2011 @ 02:46 PM
this issue
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets...
points out this inconsistency between create and drop behaviour and
to my satisfaction a non-sneaky solution seems agreed upon:to have
RAILS_ENV=development rake db:create
do what is says (create ONLY dev and not test) in the doc
$ rake -D db:create (in /home/tron/Work/Repowt) rake db:create Create the database from config/database.yml for the current Rails.env (use db:create:all to create all dbs in the config)
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>