title: How do you document your database structure?
body: <p>Many database systems don't allow comments or descriptions of tables and fields, so how do you go about documenting the purpose of a table/field apart from the obvious of having good naming conventions?</p>
  
  <p>(Let's assume for now that "excellent" table and field names are not enough to document the full meaning of every table, field and relationship in the database.)</p>
  
  <p>I know many people use UML diagrams to visualize the database, but I have rarely&mdash;if ever&mdash;seen a UML diagram including field comments. However, I have good experience with using comments inside <code>.sql</code> files. The downside to this approach is that it requires the <code>.sql</code> files to be manually kept up-to-date as the database structure changes over time&mdash;but if you do, you can also have it under version control.</p>
  
  <p>Some other techniques I have seen are separate document describing database structure and relationships and manually maintained comments inside ORM code or other database-mapping code.</p>
  
  <p>How have you solved this problem in the past? What methods exists and what are the various pros and cons associated with them? How you would you like this solved in "a perfect world"?</p>
  
  <p><strong>Update</strong></p>
  
  <p>As others have pointed out, most of the popular SQL engines do in fact allow comments, which is great. Oddly enough, people don't seem to be using these features much. At least not on the projects I have been involved with in the past.</p>