What should rake db:test:clone do?

Colin Law clanlaw at googlemail.com
Sat Sep 25 13:14:44 UTC 2010


On Rails 2.3.8 I expected rake db:test:clone to make a complete copy
of the development db as the test db.  Having tried it, however, it
seems only to copy the structure.

What I am actually trying to achieve is to make an sqlite copy of the
mysql development db as I am moving to a different development machine
and want to use sqlite for development rather than mysql, so I need an
sqlite version of the existing development db.  I changed database.yml
so that the test section reads:

test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

and checked that the tests run, which they do.

I then thought that an easy way to get an sqlite version of the
development db was to use rake db:test:create and simply rename
test.sqlite3 as development.sqlite3 ready for use.  As I said above,
however, the rake command appears to have constructed an empty test
db.  The development section of database.yml is still referencing the
mysql database of course.

Can anyone offer any suggestions?

Colin




More information about the ubuntu-users mailing list