From DTD to Rails Migrations
In the category of tools that I want, but better not make right now, lest it turn into a “paroxysm of generalization”:
I have a DTD, describing a bunch of entities, their relationships, and their attributes. I’m going to push data from a set of XML files (adhering to said DTD) into a Ruby-on-Rails savvy database. Wouldn’t be nice to have a simple tool that, in the most general way possible, would, given that DTD:
Issue a series of ’script/general model Foo’ commands for the various entities.
Populate the Rails migration files appropriately, to manage the creation of the database tables for these entities. That would include inserting :foo_id columns for has-many and has-and-belongs-to-many relationships (though differentiating between the two might require some human supervision), and exploiting the wonderful Red Hill Foreign Key Migrations to create appropriate FK constraints.
In addition / as an alternative to using the Red Hill plugin, insert the appropriate has_many / habtm declarations in the model files.
And finally, make a script that can read a set of such XML files and fill the database appropriately.
Well, sounds nice to me, anyway. Put it on the someday-maybe list.



