Apidb reformatting

Various formatting improvements to the apidb files and SQL.

Add ?w=1 to the URL to hide whitespace changes.