Error with db:migrate

I’m new to ROR, and am working my way through the Agile Web D.
Book. In the test application, the authors tell me to test my database
connection by performing “rake db:migrate”.

When I do, I get the error “Don’t know how to build task ‘db:migrate’”
I’ve been looking around at the files, and I see a reference to a
db/migrate directory (I’m running on Ubuntu Linux). My db directory is
empty.

I’ve rechecked my steps several times, and I’ve followed instructions. I
can connect to the database from MySQL (I’m running 4.1) using the
configured user and password.

Can anyone offer some help? Remember that I’m new to ROR, so some of the
things that seem obvious may not be to me.

Thanks in advance
—Michael

Michael S. wrote:

When I do, I get the error “Don’t know how to build task ‘db:migrate’”
I’ve been looking around at the files, and I see a reference to a
db/migrate directory (I’m running on Ubuntu Linux). My db directory is
empty.

Michael,

What happens if you go to the root directory of your project
(…/rails-apps/myproject1 or something) and type:

rake --tasks

What happens?

Also, what happens when you type script/about or script/console.

-damon
http://damonclinkscales.com/

Damon C. wrote:

Michael S. wrote:

When I do, I get the error “Don’t know how to build task ‘db:migrate’”
I’ve been looking around at the files, and I see a reference to a
db/migrate directory (I’m running on Ubuntu Linux). My db directory is
empty.

Michael,

What happens if you go to the root directory of your project
(…/rails-apps/myproject1 or something) and type:

rake --tasks

I get the following:

[email protected]:~/ruby/rails/depot$ rake --tasks
(in /home/michael/ruby/rails/depot)
rake apidoc # Build the apidoc HTML Files
rake appdoc # Build the appdoc HTML Files
rake clear_logs # Clears all *.log files in log/
rake clobber_apidoc # Remove rdoc products
rake clobber_appdoc # Remove rdoc products
rake clone_structure_to_test # Recreate the test databases from the
development structure
rake db_structure_dump # Dump the database structure to a SQL
file
rake default # Run all the tests on a fresh test
database
rake doc # Generate API documentation, show coding
stats
rake environment # Require application environment.
rake migrate # Migrate the database according to the
migrate scripts in db/migrate (only supported on PG/MySQL). A specific
version can be targetted with VERSION=x
rake purge_test_database # Empty the test database
rake reapidoc # Force a rebuild of the RDOC files
rake reappdoc # Force a rebuild of the RDOC files
rake recent # Run tests for
recentclone_structure_to_test
rake stats # Report code statistics (KLOCs, etc) from
the application
rake test_functional # Run tests for test_functional
rake test_units # Run tests for test_units

What happens?

Also, what happens when you type script/about or script/console.

script/about is unknown; doesn’t exist.

script/console gives the following:

[email protected]:~/ruby/rails/depot$ script/console
Loading development environment.

-damon
http://damonclinkscales.com/

Your version of Rails is quite old. The newest stable (1.1.2?) has a ton
more tasks and uses the namespace syntax. You should install the newest
version of Rails (probably just gem install rails) and try again.

Though you should see in that list the ‘migrate’ task, that’s the same
thing as doing ‘db:migrate’ in newer Rails.

Jason

Michael S. wrote:

Jason R. wrote:

Your version of Rails is quite old. The newest stable (1.1.2?) has a ton
more tasks and uses the namespace syntax. You should install the newest
version of Rails (probably just gem install rails) and try again.

will do. Thanks for the help. I’m sure I’ll be back here as I progress.

Good deal. Jason’s got ya covered. Get yourself updated to 1.1 and
your example should work just fine. Otherwise, use “migrate” instead of
“db:migrate” as was suggested.

Best,
-damon
http://damonclinkscales.com/

Jason R. wrote:

Your version of Rails is quite old. The newest stable (1.1.2?) has a ton
more tasks and uses the namespace syntax. You should install the newest
version of Rails (probably just gem install rails) and try again.

will do. Thanks for the help. I’m sure I’ll be back here as I progress.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs