Bug? Rake::Task["db:migrate"].invoke doesn't work on development db

Dear all,

task 'test' do   Rake::Task['db:create:all'].invoke   Rake::Task['db:migrate'].invoke end

Did I miss something or what? Turns out that this simple task would have migration done in the test db.

I've tried to "puts RAILS_ENV" inbetween and it shows "development", but migration's still done in the test db.

Any ideas? Thanks.

ps. However if I break the 2 lines into 2 separate tasks, run them individually; then migration's done in the development db as expected.