Rails 3: "Schema migrations table does not exists yet"

So some months ago, for some reason I got a weird git message and was afraid to deploy. So I started making changes to the production application directly and trying to also manually make the same changes to my local code.

So now the time came to update everything, I wanted to sync my local code with the production code and start using git and capistrano to deploy again. So I downloaded the code from the production server and copy pasted some files into my local code to make sure I wasn't going to overwrite anything on the production server.

I'm now able to run cap:deploy and everything seems to work as expected. Problem is, I created a new column on my dev copy and I was about to run cap deploy:migrate but I'm afraid it's going to wipe out my production database.

So I ran rake db:migrate:status and I get the message Schema migrations table does not exists yet. I already checked my production database and the schema migrations table IS there. So it seems the app is not recognizing my current migration version and I'm afraid that if I run cap deploy:migrate is going to run ALL the migrations and wipe out my database.

Why am I getting this message? What should I do?

Answers


My situation may be somewhat different from you but I too got the same message. I was in development in my local PC with Rails 4.

Try using only db:migrate.


A solution I've found is to use abort_if_pending_migrations:

export RAILS_ENV=production; bundle exec rake db:abort_if_pending_migrations

This seems to print nothing if your migrations are up-to-date, and list tables that need updating if they are not. This is with Rails 4.1.8.


Need Your Help

SQL Server Syntax Error on PIVOT

sql-server pivot

Can anyone please help me with the PIVOT table syntax error as I am using this for the First time.

Trying to make animation on SurfaceView's canvas

java android animation canvas

I've made a game with a player that looks like this: