Forum: Ruby on Rails rake db:migrate

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E67091aaacd7aaeaef0b05452bb42ae6?d=identicon&s=25 Hao Min (hao922)
on 2006-06-04 05:43
I created a model and specify the columns in the database table. But
when I use "rake db:migrate" to migrate the database table. It keeps
igoring the command. (but not Aborted) it just does not give any result,
and the table was not created in the database.

When I tried it in another project folder and did exactly the same
thing, it worked. It just does not work in that specific project.

Does anyone know what the problem is? Thanks for help.
D0cd6b10e01bacb976b3b815a9c660bc?d=identicon&s=25 Alex Wayne (Guest)
on 2006-06-04 05:50
hao min wrote:
> I created a model and specify the columns in the database table. But
> when I use "rake db:migrate" to migrate the database table. It keeps
> igoring the command. (but not Aborted) it just does not give any result,
> and the table was not created in the database.
>
> When I tried it in another project folder and did exactly the same
> thing, it worked. It just does not work in that specific project.
>
> Does anyone know what the problem is? Thanks for help.

I think you may be confused about migration.  If you "specify the
columns in the database table" then you are not using migrations.

"rake db:migrate" makes sure your database is up to date by executing
the files in db/migrations/xxx_create_some_table.rb

1. ruby script/generate model SomeModel
   or
   ruby script/generate migration AddFooToBars

2. Edit the new file in db/migrations that was just created.

3. Now run "rake db:migrate"  The database changes you just defined
should be applied to your database.
E67091aaacd7aaeaef0b05452bb42ae6?d=identicon&s=25 Hao Min (hao922)
on 2006-06-04 06:04
>
> I think you may be confused about migration.  If you "specify the
> columns in the database table" then you are not using migrations.
>
> "rake db:migrate" makes sure your database is up to date by executing
> the files in db/migrations/xxx_create_some_table.rb
>
> 1. ruby script/generate model SomeModel
>    or
>    ruby script/generate migration AddFooToBars
>
> 2. Edit the new file in db/migrations that was just created.
>
> 3. Now run "rake db:migrate"  The database changes you just defined
> should be applied to your database.

Hi, Alex   That is what I have done for my "Order" model. After I
generate the model, I edited "create_orders"file in the migration folder
and then rake db:migrate
The result is like what I described above.
This topic is locked and can not be replied to.