Question: Hello I am new to rails.
I am working with an existing postgres db. I would like to create CRUD for all of the tables.
I've started with:
rails g scaffold firstTableName

Then I start rails:
rails s

When I navigate to localhost:3000/firstTableName, rails gives the following error:
Migrations are pending; run 'bin/rake db:migrate RAILS\_ENV=development' to resolve this issue.

I thought that 'rake db:migrate' was only for setting up your database. My db is already set up. If I run 'rake db:migrate', then I get an error that firstTableName already exists.
Please Help me understand how to make rails happy.
Thank you.

Answer: 
the error is because you already have the table firstTableName is already present and as you did scaffold, it will create the model, controller and view for you, so it has also create the migration for the firstTableName. 

If you already have the migration in place try skipping the migration while scaffolding

> 
> rails g scaffold firstTableName --skip-migration
> 
> 
>
When you run migrations rails keeps track of these by matching each migration in db/migrate folder with an entry in schema\_migrations table that includes timestamp for all the migrations that rails has already run for that environment in versions column.

Reason is to allow you to migrate incrementally.

Earlier versions of rails had a strong philosophy of having a down migration as well to go back in time. However, that has been left as a choice now.

Your complaint is because it was not able to create schema\_migrations table. My suggestion is to allow it to do so by running rake db:migrate on a fresh db. 

If you have data in the tables on this instance run it on another database and then just copy across the versions table.

<http://guides.rubyonrails.org/migrations.html>