Move to a seperate module level global for SQLALchemy metadata

This will prevent issues with circular imports
Register the SQLAlchemy table metadata
Use real imports for the models
Merge pull request #180 from dstufft/fix-migrations

Fix migrations and cleanup circular import problems
Merge branch 'master' into download-statitics
Fixed for the new location