Reputation: 1491
So I have an existing postgres database which gets populated by a python script. Now I am making a rails api which serves that data to a client. To my amusement all that I had to do is to create model classes and simply define relationships. No migration files, no schema, it just works. So a couple of questions.
schema.rb
is only needed for creating the
database? If I am not running any migrations in my rails app I don't
need any schema or migration files at all?Upvotes: 1
Views: 279
Reputation: 791
schema.rb is indeed not required by ActiveRecord.
It is used for:
db:schema:load
task TL:DR; - you don't really need schema.rb file but it's always good to have it as an authoritative source of db information.
More info here: http://edgeguides.rubyonrails.org/active_record_migrations.html#schema-dumping-and-you
Upvotes: 2