Here is the database schema, and the tool I wrote to extract it.  It's flat at the moment - I'll put the constraints in later.