1
votes

I have a simple rails app without dependencies (rails new example). Then I created a scaffold Student (rails g scaffold Student name:string). After, I run rake db:create and then rake db:migrate.

rake db:migrate returns nothing. It's not executing my migration, without no error on the screen. But, when I execute rake db:migrate VERSION=123456 the migration runs properly.

Do you have any idea what is happening with rake db:migrate without version? (I'm on MAC OS X)

thanks

1
Are there any new migrations to "migrate"?benchwarmer
Yes, there is one. I did the following steps: rails new my_app && rails g scaffold Student name:string && rake db:create && rake db:migrateuser1985010
@user1985010- VERSION=123456 doesn't make sense unless you have Student migration with this particular version number.My God
rake db:migrate executes nothing only when all the migrations are already run and rake db:migrate VERSION= 123456 executes the migration with this version number.My God
Did you cd new_app after creating the Rails app? See your db/schema.rb file. What version number is shown there? Example: ActiveRecord::Schema.define(:version => 20130305185827). If everything else fails, do a rm db/schema.rb and migrate again.Leonel Galán

1 Answers

6
votes

The only logical answer I can come up is that your environment has the variable VERSION set with 0. Type this in the command line echo $VERSION

If you do, running rake db:migrate should be equivalent to rake db:migrate VERSION=0 which would behave similarly to what you are describing. Unset the variable (unset VERSION) and try again.

If you don't, this answer is clearly incorrect.