views:

207

answers:

5

I know there are many database design tool, database modeling tool. Example, ER-win , db desginer and etc.

But, they are not supported for Ruby on Rails.

What is the best way or tool to design database for Ruby on Rails?

Appended:

I know the rails development phases are growing step by step. But, When starting of project, I think database modeling has to be first. Which database modeling tool can I use?

+5  A: 

With Rails, you don't. You design the object model, the database model is generated. All database handling is done in the model.

Pascal Thivent
Long time ago, when there was no migration we create the database first, because Rails is using the active record pattern and hardly nothing is written on the model.
jpartogi
+2  A: 

With Rails you use migrations to design your database. Give migrations a shot - I thought I would miss the diagrams in SQL Server when I started working with Rails but I don't.

You can see your schema in a very readable text form at db/schema.rb

Andy Gaskell
A: 

You can certainly use those tools to create your database, but without having experience with how rails deals with relationships you may run into trouble. Not that you can't work around the default way rails does things, but you'll make it a lot tougher on yourself.

So design your database, but know rails associations.

Mike
+1  A: 

You're working at it backwards. Don't figure out the table structure you need, then build your application around it. The Rails Way is to start building your application's functionality, piece by piece, and add migrations to build up your database as you need it.

You'll end up with a simpler data model, nothing you don't need, and your data structure will reflect the interactions people have with your site instead of the other way around.

SFEley
A: 

Like others have said, you should give migrations a shot. The Rails Getting Started guides are extremely helpful in explaining how this works.

http://guides.rails.info/getting%5Fstarted.html

This one is specifically about migrations: http://guides.rails.info/migrations.html

Trying doing a basic migration, and you'll see it's incredibly easy. If you need to make changes or alter your migration, then check out that second link that covers more detail about migrations.

The Rails documentation is also pretty helpful for migrations: http://api.rubyonrails.org/classes/ActiveRecord/Migration.html

I know documentation on these things can sometimes be terrible, but in this case it's worth taking a look.

MikeH