Rake db:create doesn't create all databases?

I was trying to create a test case in Rails 3.0 RC2 for an entirely
separate question about connecting to external databases via
establish_connection, but ran into a problem with rake db:create.

In short, “rake db:create” only creates two of the four databases listed
in config/database.yml, and I can’t figure out why. Here’s the
database.yml file. The only thing out of the ordinary is the :external
database specification, but notice that its params are identical to the
others:

========= file: config/database.yml
development:
adapter: mysql
encoding: utf8
reconnect: false
database: dbtest_development
pool: 5
username: root
password: XYZZY
socket: /tmp/mysql.sock

external:
adapter: mysql
encoding: utf8
reconnect: false
database: dbtest_external
pool: 5
username: root
password: XYZZY
socket: /tmp/mysql.sock

test:
adapter: mysql
encoding: utf8
reconnect: false
database: dbtest_test
pool: 5
username: root
password: XYZZY
socket: /tmp/mysql.sock

production:
adapter: mysql
encoding: utf8
reconnect: false
database: dbtest_production
pool: 5
username: root
password: XYZZY
socket: /tmp/mysql.sock
========= EOF

But rake db:create only creates the _development and _test databases,
not the _external nor _production. Here’s the synopsis. My db BEFORE:

=========
bash$ mysql -u root -pXYZZY

mysql> show databases;
±-------------------+
| Database |
±-------------------+
| information_schema |
| mysql |
| test |
±-------------------+
3 rows in set (0.00 sec)
mysql> quit

When I execute ‘rake db:create’, it appears to complete without error:

=========
bash$ rake db:create --trace
rake db:create --trace
(in /Users/r/Developer/dbtest)
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:create

… but the resulting database only has the _development and _test
databases, as shown here:

=========
bash$ mysql -u root -pXYZZY

mysql> show databases;
±----------------------+
| Database |
±----------------------+
| information_schema |
| dbtest_development |
| dbtest_test |
| mysql |
| test |
±----------------------+
5 rows in set (0.00 sec)
mysql> quit

What’s odd is that I’ve looked at the sources in

usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/railties/databases.rake

and I can’t see a reason that either _external or _production would be
skipped, especially without some error message.

Can any of the wizards out there explain this, or suggest a test I run
to analyze this in more depth?

TIA.

  • ff

crap. nebbermind. i was reading the wrong piece of code; all i really
needed to do was:

rake db:create:all

and all is happy. pardon the noise (but maybe my experience will help
someone else in the future).

  • ff