Fix the type of the 'masterid' case statement

It seems that newish versions of pg8000 complain (probably correctly)
that a case statement is of text type, but the masterid column should be
an integer.  This adds an explicit cast, which works fine across all
three database engines.
Merge pull request #1255 from djmitche/025-masterid-type-fix

Fix the type of the 'masterid' case statement

See ticket:2933
Fix SQLAlchemy-Migrate version check

It failed for strings like `'0.9.1-r0'`.

```
$ buildbot create-master foobar
[...]
  File "/usr/lib/python2.7/site-packages/buildbot/db/model.py", line 547, in upgrade
    check_sqlalchemy_migrate_version()
  File "/usr/lib/python2.7/site-packages/buildbot/db/model.py", line 502, in check_sqlalchemy_migrate_version
    version_tup = tuple(map(int, version.split('.')))
exceptions.ValueError: invalid literal for int() with base 10: '1-r0'

$ python2 -c "import migrate; print(migrate.__version__)"
0.9.1-r0
```
Merge heinrich5991/buildbot:pr_versioncheck (PR #1259)
Update the docs URL to docs.buildbot.net
Merge pull request #1260 from pquentin/master

Update the docs URL to docs.buildbot.net
buildrequest collapse
 - TODO: fix test_process_buildrequestdistributor (collapse request isn't done in the brdistributor)