Rake db:create:all creates databases but doesn't create their tables

Hi All,

I’m stilling running:
WinXP-Pro/SP3
Rails 2.3.5
MySQL 5.0.37-community-nt

I have exhaustively tested MySQLd server using the MySQL monitor by:
Creating a database
Creating a table with columns
Populating a table with a row
Dropping a table
Dropping databases

I check that a migration I created days ago is still populated
correctly.

All I get from rake db;create:all is, consistent with database.yml:
empty tables if they do not already exist
announcements/warnings if the tables already exist (without recreating
them so that populated tables maintain whatever definitions/data that
they had)

Does anyone know whether the software connecting Rails 2.3.5 to MySQL
5.0.37 really works as intended? Or can anyone recommend a
configuration that is known to work?

Thanks in Advance,
Richard

All I get from rake db;create:all is, consistent with database.yml:
empty tables if they do not already exist
announcements/warnings if the tables already exist (without recreating
them so that populated tables maintain whatever definitions/data that
they had)

Hi Richard - it’s possible I misunderstand the question, but judging
from the title of your post, could the problem be that you are
creating the database but aren’t running the migrations to create the
tables?

rake db:create:all

creates the development, test and production databases on the server,
akin to the executing SQL DDL like “CREATE DATABASE xxx.” This
wouldn’t create any tables.

To actually create the tables defined in your migrations (or create
indexes, or alter the tables, or any of the other stuff you define in
migrations), you would run:

rake db:migrate

which executes any migrations that haven’t already been run already in
the current default environment database (say, development if you are
working in development), akin to executing SQL like “CREATE TABLE xxx”
or “ALTER TABLE”, etc. This of course assumes you have generated some
migrations (it sounds like you have).

-Steve

rake db:migrate

That did it!!! I’ve been racking my brains over this for two, just
because I want to adopt what I feel are “best practices”. You’ve
rescued me from an embarrassing ordeal.

Thank you very much for your insight Steve.

Richard

Hi Charles,

Check out my reply to Steve R. and my original post on this
thread.

Best wishes,
Richard

On Feb 23, 7:04 pm, “Charles A. Lopez” [email protected]

what are you expecting to happen that isn’t happening?

On 23 February 2010 18:47, RichardOnRails <
[email protected]> wrote:

Populating a table with a row
they had)
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected][email protected]
.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


Charles A. Lopez
[email protected]

What’s your vision for your organization?
What’s your biggest challenge?

Let’s talk.
(IBM Partner)

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