Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

[PATCH] rake db:create creates development db only

#4128

Perhaps we should use rake db:create:all to create all the databases or rake db:create RAILS_ENV=test to create only test

Reported by Santiago Pastorino · March 8th, 2010 @ 01:48 AM

State: wontfix
Milestone: 3.0.2
Assigned to: Mikel Lindsaar Mikel Lindsaar
Importance: none

Activity

  1. Mikel Lindsaar
    Mikel Lindsaar

    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

    March 9th, 2010 @ 02:35 AM

  2. Santiago Pastorino
    Santiago Pastorino

    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.

    March 9th, 2010 @ 10:22 AM

  3. Santiago Pastorino
    Santiago Pastorino

    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

    March 9th, 2010 @ 11:31 AM

  4. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to wontfix

    I understand now what you do Mikel, thanks

    March 9th, 2010 @ 06:16 PM

  5. Jeremy Kemper
    Jeremy Kemper

    This is because db:reset and db:setup tasks depend on it, and it's convenient to have test db created along with dev.

    March 9th, 2010 @ 06:25 PM

  6. Jeremy Kemper
  7. viktor tron (strawberry)
    viktor tron (strawberry)

    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)
    

    January 12th, 2011 @ 02:46 PM