This project is archived and is in readonly mode.
Sqlite errors when using dbfile directive in database.yml
-
Paul Hinze
- Assigned user set to Jeremy Kemper
- Tag changed from 2.3.2, database, database.yml, sqlite to 2-3-stable, 2.3.2, database, database.yml, dbfile, railties, sqlite, sqlite3
I just found a related issue with using
rake db:dropgiven a SQLite database.The related block of code from
railties/lib/tasks/databases.rake:def drop_database(config) case config['adapter'] # ... when /^sqlite/ FileUtils.rm(File.join(RAILS_ROOT, config['database'])) # ... end endIf this is called when only the dbfile config option is provided, you get an error as you'd expect:
Couldn't drop : #<TypeError: can't convert nil into String>
Looked in 2-3-stable and it seems like there are some places where both are supported and others (like the two mentioned here) where only the
databasekey is used.The way forward it seems it to be one of these two options:
- officially deprecate
dbfileand therefore include code to warn users of this fact - ensure support for
dbfileeverywhere thedatabaseconfig option is used
I've attached a patch against 2-3-stable that should fix the two issues mentioned in this ticket, but making the above decision is more important for this ticket.
Assigning to the last committer to the line in question for
databases.rakejust to have someone listed. -
Jeremy Kemper
- State changed from new to resolved
- Milestone changed from 2.x to 2.3.4
-
David Kelso
Great! Thanks for solving this!
