Script to generate Relations

Hi,

I just had the idea, that it should be possible to do something like
that:

ruby script/generate relation Item has_and_belongs_to_many Tags

This would do following things:

* Create a migration with the table needed for the m:n relation. For 

other relations it would add a migration that adds the needed foreign
keys to the db schema (i.e. Post has_many Comments would lead to a
migration that adds the field post_id(int) to the comments table).
* Automagically insert the :has_and_belongs_to_many statement into
the models as needed (other relation types would obviously lead to
different stamtements, i.e. for 1:n relations).
* Perhaps there should be a script that tears down relations
(deleting the columns from the tables and the relation statements in the
models).
* Do other things that I have not though of.

What do you think about this? Please feel free to discuss this (here?)!

Greetings,

Robo