This project is archived and is in readonly mode.

#614 ✓committed
Antonio Cangiano

Fix SQLite's db creation warnings

Reported by Antonio Cangiano | July 13th, 2008 @ 10:00 PM | in 2.x

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.

Comments and changes to this ticket

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>

Attachments

Referenced by

Pages