Zirael
September 9, 2008, 2:10pm
1
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
Zirael
September 9, 2008, 2:42pm
2
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.
Zirael
September 10, 2008, 9:16am
3
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?
Zirael
September 10, 2008, 9:23am
4
On 10 Sep 2008, at 08:15, Zirael wrote:
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
Zirael
September 11, 2008, 4:00pm
5
Thx, that plugin let me save lot of time.
There is only problem with polymorphic relationship.