Rake db:migrate - where is my table?

Not sure if this is another rails 2.0 issue and the info in AWDWR 2nd
ed, or not…

(I’m new to Rails) I modified the 001_create_products.rb file and
added the needed info to create 3 tables in a database that I created
using CocoaMySQL. When I ran “rake db:migrate” the info on the console
looked good. I then go into CocoaMySQL, select that same database, but
there are no tables in it. Any ideas? I also use mysql on the command
line to look at that database, but no table to be found. What up with
that?

Thanks.

Are you sure you specified the correct database in config/database.yml?

On Dec 27, 2007 1:13 PM, alfredojahn [email protected] wrote:

that?

Thanks.


Ryan B.
http://www.frozenplague.net
Feel free to add me to MSN and/or GTalk as this email.

On Wed, 26 Dec 2007 18:43:37 -0800, alfredojahn wrote:

When I ran “rake db:migrate” the info on the console looked good.

What’s the result of:

rake db:migrate VERSION=0 --trace

-Thufir

Thufir if u have different doubt than the existing thread pls dont post
there itself start a new thread and post there…

So that the continuity/tracability will be maintained…

Thufir wrote:

On Wed, 26 Dec 2007 18:43:37 -0800, alfredojahn wrote:

When I ran “rake db:migrate” the info on the console looked good.

What’s the result of:

rake db:migrate VERSION=0 --trace

-Thufir

rake db:migrate – this will create tables for you as described in
migration files into the database specified in the database.yml file

VERSION=0 – If you are using a version control system it’ll consider
the zeroth version of yr project(Mostly initial import to the
repository), This can be skipped actually.

–trace this is the additional attribute passed with rake command to see
the complete log message.

You can carry out this jus by giving rake db:migrate this will hold
good.

On Thu, 27 Dec 2007 08:31:26 +0100, Ratnavel S. wrote:

Thufir if u have different doubt than the existing thread pls dont post
there itself start a new thread and post there…

Pardon, I don’t follow your point. Yes, I’m all for thread continuity
:slight_smile:

-Thufir

On Dec 26, 2007 9:43 PM, alfredojahn [email protected] wrote:

Not sure if this is another rails 2.0 issue and the info in AWDWR 2nd
ed, or not…

(I’m new to Rails) I modified the 001_create_products.rb file and
added the needed info to create 3 tables in a database that I created
using CocoaMySQL.

Had you already migrated using this migration before you modified it?
This is the picture I get from saying you modified it rather than
creating it.

When I ran “rake db:migrate” the info on the console
looked good. I then go into CocoaMySQL, select that same database, but
there are no tables in it. Any ideas? I also use mysql on the command
line to look at that database, but no table to be found. What up with
that?

If you really did modify it, then rake db:migrate probably didn’t do
anything other than get the current schema version from the database,
notice that it was already 1, and quit.

In general you want to generate a new migration each time you make a
schema change to the database.


Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

alfredojahn wrote:

I then go into CocoaMySQL, select that same database, but
there are no tables in it. Any ideas? I also use mysql on the command
line to look at that database, but no table to be found. What up with
that?

I had the same problem as you and found my answer here:

"SQLite3 is the new default database…

If you want to preconfigure your database for MySQL (or any of the other
adapters), you simply do “rails -d mysql myapp” and everything is the
same as before. "

So I recreated my app as above and the tables are now showing in MySQL.

Greg.

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