I’ve got the assignment to make some sense out of our legacy database. I
thought a neat way to do that might be via ActiveRecord so that I could
present my findings like “A user has many letters, each letter belongs
to a recipient, each recipient has many email addresses…” like dat.
So what I’m wondering is whether ActiveRecord (or some other feature)
gives me the ability to poke around a connection, querying things like
“show tables”. If I could do that, then I could use what I know of our
naming scheme to start making some educated guesses, like:
if you find a table named “foo_table”, then it houses objects of type
the primary key for table Foo is foo_id
if you find a column called bar_id in a table, then assume that there
and so on. I’d want to take a global view of the entire database so I
could see how much coverage I was getting, and what I was missing.
Ideally I’ll use ActiveRecord as much as possible to setup Ruby objects
whenever I find a business object to point to (probably auto generating
the code). But to fill in the cracks I’ll need to hit up the database
Can I do that? I’m running this all on my local snapshot of the
database so it’s entirely a personal project, not gonna hurt anybody but
myself. Just wondering, really, if I can do such a thing.