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

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

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.

Hi Charles,

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

Best wishes, Richard