Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10577 (closed defect: fixed)

Opened 7 months ago

Last modified 7 months ago

[PATCH] Don't silently ignore errors removing sqlite db in db:drop:all task

Reported by: mrichman Assigned to: core
Priority: normal Milestone: 2.0.3
Component: ActiveRecord Version: 2.0.1
Severity: normal Keywords: rake sqlite sqlite3
Cc:

Description

rake db:drop:all fails quietly for SQLite3 if the .sqlite3 file is currently open using sqlite3.exe. To reproduce:

1) open development.sqlite3 using sqlite3. 2) run db:migrate (or just raw SQL) to create a database object 3) execute ".schema" in sqlite3 4) sqlite3 displays the db schema 5) execute rake db:drop:all 6) execute ".schema" in sqlite3 7) sqlite3 displays the db schema unchanged

Attachments

expose_errors_when_dropping_sqlite.diff (0.5 kB) - added by chuyeow on 12/23/07 04:25:38.

Change History

12/23/07 04:25:38 changed by chuyeow

  • attachment expose_errors_when_dropping_sqlite.diff added.

12/23/07 04:30:06 changed by chuyeow

  • priority changed from high to normal.
  • severity changed from major to normal.
  • summary changed from rake db:drop:all fails quietly for SQLite3 to [PATCH] Don't silently ignore errors removing sqlite db in db:drop:all task.

Ah that's because the error is being silently ignored (your sqlite3.exe process has a lock on the file so the rake task can't delete it).

I suggest simply doing FileUtils.rm instead of rm_f which hides any (well, most) errors.

01/02/08 08:29:01 changed by bitsweat

  • status changed from new to closed.
  • resolution set to fixed.

(In [8519]) SQLite: db:drop:all doesn't fail silently if the database is already open. Closes #10577.

01/02/08 08:34:48 changed by bitsweat

(In [8520]) Merge [8519] from trunk: SQLite: db:drop:all doesn't fail silently if the database is already open. References #10577.