Forum: Ruby on Rails migrate problem (have to go back, then forward, to "stick")

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.
dankelley (Guest)
on 2007-01-19 17:30
(Received via mailing list)
I wonder if I'm reading the various tutorials (and Agile book, version
2) incorrectly...

I make an app, and then edit e.g. by adding a new column to
  migrate/002_stuff.db
and then run
  rake migrate
  rake db:structure:dump && cat db/development_structure.sql
but I see no change in the database.

However, the database *is* updated if I do
  rake migrate VERSION=0
  rake migrate

But isn't one supposed just to edit the migrate/*.rb files and do
  rake migrate
?
Matthew M. (Guest)
on 2007-01-19 17:31
(Received via mailing list)
dankelley wrote:
>
> However, the database *is* updated if I do
>  rake migrate VERSION=0
>  rake migrate
>
> But isn't one supposed just to edit the migrate/*.rb files and do
>  rake migrate
> ?
>
>
> >
When you just run rake migrate you are telling the system to run all the
migration files that are a higher number than your current db version.
If you are already at version 2 and you run rake migrate after editing
002_stuff.rb nothing new will happen.  When you run rake migrate
VERSION=0 then you are resetting things so 002_stuff.rb is a newer
file(2) than your db state(0).

Matt M.
blog.mattmargolis.net
This topic is locked and can not be replied to.