Generating an image of a database schema used in a Rails app

Readonly picture Readonly · Jan 26, 2009 · Viewed 11.2k times · Source

How can I go about generating an image of a database schema used in a Rails app?

Answer

Tom picture Tom · Jan 26, 2009

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.