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.

There was a problem

This project is archived and is in readonly mode.

Fix SQLite's db creation warnings

#614

Running rake db:create (or rake db:create:all) results in an error message such as, "db/development.sqlite3 already exists". The error message is always printed regardless of whether the database already existed or not.

This is due to the fact that the create_database method in railties/lib/tasks/database.rake wrongly assumes that the following two lines attempt a connection only:

ActiveRecord::Base.establish_connection(config)
ActiveRecord::Base.connection

In reality, the SQLite adapter will automatically create the database if it doesn't exist already and no errors are raised. Therefore the else clause of the begin/rescue statement is invoked every time, in turn printing the message mentioned above.

The attached patch fixes this.

Reported by Antonio Cangiano · July 13th, 2008 @ 10:00 PM

State: committed
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Alex MacCaw
  2. Pascal Ehlert
    Pascal Ehlert

    Really annoying bug, +1 for this.

    Could you please add some tests, Antonio?

    July 17th, 2008 @ 12:26 PM

  3. Pratik
    Pratik
    • Title changed from [PATCH] Fix SQLite's db creation warnings to Fix SQLite's db creation warnings

    August 21st, 2008 @ 12:49 PM

  4. DHH
    DHH
    • State changed from new to committed

    September 10th, 2008 @ 05:57 AM