Peter Berg
Peter Berg

Reputation: 6206

Schema.rb doesn't include table that exists

I've run all of my migrations and my schema.rb does not include a "create table" line for table that clearly should exist. The table actually shows up in the rails console too, when I access it via its corresponding ActiveRecord class.

Any ideas why this might be happening? And what the consequences of this discrepancy in the schema could have moving forward? The project appears to be working fine.

Upvotes: 0

Views: 1550

Answers (1)

Eyeslandic
Eyeslandic

Reputation: 14890

You can update your schema.rb to mirror the database with this command.

bundle exec rake db:schema:dump

Schema.rb is not used in development or production so it has no effect on a running application. However it is used when setting up the test database. Can read about it more http://guides.rubyonrails.org/migrations.html#schema-dumping-and-you

Upvotes: 2

Related Questions