Zirael
(Zirael)
September 9, 2008, 12:09pm
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
11175
(-- --)
September 9, 2008, 12: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
(Zirael)
September 10, 2008, 7:15am
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?
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
(Zirael)
September 11, 2008, 1:59pm
5
Thx, that plugin let me save lot of time.
There is only problem with polymorphic relationship.