How can I go about generating an image of a database schema used in a Rails app?
The schema. rb serves mainly two purposes: It documents the final current state of the database schema. Often, especially when you have more than a couple of migrations, it's hard to deduce the schema just from the migrations alone.
Have you tried rake db:schema:dump
?
Essentially, make sure that your database.yml
file is referencing the database you wish to dump, and then run the command. It'll take all of the tables and indexes in said database and then write it out to schema.rb
.
Note that you should rename schema.rb
once it contains the dump; otherwise, it could it overwritten.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With