ActiveRecord - schema and relations between

Hi,

I have quite complex db schema created by ActiveRecord and every constraints/relations are defined only in ActiveRecord objects.

I am going to create db schema diagram like ERD etc.

Do you have any idea how to do it?

It is fine too if I could build constraints in db.

Maybe one of you created an appropriate rake?

Greets, Mirek

If you want to add constraints in the DB, you can always use execute within your migrations...

execute "ALTER TABLE `projects` your SQL goes here, blah blah blah"

Just execute the appropriate SQL statements in the self.up and self.down methods.

You are right. But it is quite difficult(get a lot of time) to create these migrations by yourself. I have 30 tables, so I am looking for rake etc. to generate it.

Do you have any idea?

You are right. But it is quite difficult(get a lot of time) to create these migrations by yourself. I have 30 tables, so I am looking for rake etc. to generate it.

Why do you want migrations if you've already got the schema? Rails
will dump your schema to schema.rb. With appropriate plugins (http://agilewebdevelopment.com/plugins/search?search=redhillonrails ) it should handle foreign keys as well.

Fred

Thx, that plugin let me save lot of time.

There is only problem with polymorphic relationship.