Don't know how to build task 'migrate --?

Environment:
Mac OS X (Leopard) version 10.5.1
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.10.1]
Rails 2.0.2
Rake, version 0.8.1

I’m following a simple example from OS X’s dev doc (“Expenses”).
My Problems: 1) I would like to work with MySQL vs sqlite3
2) Rake doesn’t know how to build; even though
I followed a simple example.


  1. Entered ‘$>rails expenses’ (at the prompt), got the ‘expenses’
    directories built.

expenses/config/database.yml:
My Default Database is sqlite3: <-- problem #1: I want MySQL; not
sqlite3.

SQLite version 3.x

gem install sqlite3-ruby (not necessary on OS X Leopard)

development:
adapter: sqlite3
database: db/development.sqlite3
timeout: 5000


  1. I MANUALLY modified the database.yml for mysql:

development:
adapter: mysql
database: db/development.mysql
host: localhost
timeout: 5000

MySQL has the following table:
mysql> use expenses_development;
Database changed
mysql> show tables;
Empty set (0.00 sec)


  1. script/generate migration accounts
    create db/migrate
    create db/migrate/001_accounts.rb

  1. edit db/migrate/001_accounts.rb:

class Accounts < ActiveRecord::Migration
def self.up
create_table :accounts do |table|
table.column :name, :string
table.column :budget, :float
end
end
def self.down
drop_table :accounts
end
end


  1. rake migrate --trace

[/Users/Ric/workarea/ruby/expenses]rake migrate --trace
(in /Users/Ric/workarea/ruby/expenses)
rake aborted!
Don’t know how to build task ‘migrate’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1634:in []' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1930:ininvoke_task’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in
top_level' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:ineach’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in
top_level' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:instandard_exception_handling’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:in
top_level' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:inrun’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in
standard_exception_handling' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:inrun’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31
/opt/local/bin/rake:16:in `load’
/opt/local/bin/rake:16


What happened?

  1. How do I change the default db to MySQL?
  2. Why can’t rake build the ‘migrate’ file?

Remedy???

Regards,

Ric.

  1. rails newProject -d mysql

  2. isn’t it rake db:migrate ? you are calling rake migrate instead

Andreh L. wrote:

  1. rails newProject -d mysql

  2. isn’t it rake db:migrate ? you are calling rake migrate instead

You’re correct on BOTH.

I was following the example too closely, lacked the db: so obviously the
build got lost:

[/Users/Ric/workarea/ruby/expenses]rake db:migrate
(in /Users/Ric/workarea/ruby/expenses)
== 1 Accounts: migrating

– create_table(:accounts)
-> 0.1104s
== 1 Accounts: migrated (0.1106s)

As for #1: Is there a way to make MySQL the de facto db so all I would
need to do is:
$> rails ?

— Thanks for pointing out the obvious!

Regards,

Ric.

how did you manage to get your modifed file with

database: db/development.mysql

yet it was able to insert into the “expenses_development” table.

i had to change my database file entry to

database: expenses_development

any thoughts?

On Feb 8, 1:14 pm, Frederick L. [email protected]