Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 960
readonly Avatar asked Jan 26 '09 22:01

readonly


People also ask

What is the schema file in rails?

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.


1 Answers

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.

like image 96
Tom Avatar answered Sep 23 '22 19:09

Tom