# Rake db:test:clone\_structure and related tasks fail

**URL:** <https://www.ruby-forum.com/t/rake-dbclone-structure-and-related-tasks-fail/174514>\
**Category:** Rails\
**Created:** [August 27, 2009, 11:01pm UTC](https://www.ruby-forum.com/t/rake-dbclone-structure-and-related-tasks-fail/174514 "2009-08-27T23:01:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomuhs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ecb155/32.png) [@tomuhs](https://www.ruby-forum.com/u/tomuhs)\
**Post date:** [August 27, 2009, 11:01pm UTC](https://www.ruby-forum.com/t/rake-dbclone-structure-and-related-tasks-fail/174514/1 "2009-08-27T23:01:21Z")

</div>

Judging by the exception’s location, the test environment config is  
not getting loaded. Do I need to do something else to activate this  
environment?

341 case abcs[“test”][“adapter”]  
342 when “mysql”  
343 ActiveRecord::Base.establish\_connection(:test)  
344 ActiveRecord::Base.connection.recreate\_database(abcs  
[“test”][“database”], abcs[“test”]) # wrong number of arguments (2 for  
1)

Here is the test dict in my database.yml:

test:  
adapter: mysql  
database: review\_test  
username: review  
password: review  
host: 127.0.0.1  
port: 3306  
encoding: utf8

Here is the trace:

% rake db:test:clone\_structure –  
trace  
(in /var/www/rails\_apps/review\_app)  
\*\* Invoke db:test:clone\_structure (first\_time)  
\*\* Invoke db:structure:dump (first\_time)  
\*\* Invoke environment (first\_time)  
\*\* Execute environment  
\*\* Execute db:structure:dump  
\*\* Invoke db:test:purge (first\_time)  
\*\* Invoke environment  
\*\* Execute db:test:purge  
rake aborted!  
wrong number of arguments (2 for 1)  
/usr/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake:  
344:in `recreate\_database’

Thanks!  
Thomas

---

<div class="post-metadata">

**Author:** ![tomuhs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ecb155/32.png) [@tomuhs](https://www.ruby-forum.com/u/tomuhs)\
**Post date:** [August 28, 2009, 9:23am UTC](https://www.ruby-forum.com/t/rake-dbclone-structure-and-related-tasks-fail/174514/2 "2009-08-28T09:23:44Z")

</div>

> rake aborted!  
> wrong number of arguments (2 for 1)  
> /usr/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake:  
> 344:in `recreate\_database’
> 
> Thanks!  
> Thomas

do you have test database created ?

---

<div class="post-metadata">

**Author:** ![tomuhs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ecb155/32.png) [@tomuhs](https://www.ruby-forum.com/u/tomuhs)\
**Post date:** [August 28, 2009, 9:29pm UTC](https://www.ruby-forum.com/t/rake-dbclone-structure-and-related-tasks-fail/174514/3 "2009-08-28T21:29:31Z")

</div>

It appears that this is coming from my installed lib/mysql\_adapter.rb  
which has an incorrect signature for recreate\_database (and probably  
for other methods as well), so I think I have what I need to solve the  
problem now.

Thomas

---

<div class="post-metadata">

**Author:** ![tomuhs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ecb155/32.png) [@tomuhs](https://www.ruby-forum.com/u/tomuhs)\
**Post date:** [August 28, 2009, 4:51pm UTC](https://www.ruby-forum.com/t/rake-dbclone-structure-and-related-tasks-fail/174514/4 "2009-08-28T16:51:27Z")

</div>

On Aug 28, 3:23 am, Nik C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Posted viahttp://www.ruby-forum.com/.  
> Yep, I do. I tried it with the MySQL test db initially (user: test,  
> pw: “”) and that failed with the same error. I’m able to connect to  
> either database both via the MySQL client and Ruby.

Thomas
