Dont build commits with the same sha more than once

Sorry for so much of a delay with this, I was doing quite a lot of back & forth with the implementation.

I ended up using postgresql string arrays for keeping branch list for a commit and a build. This by far the best answer in my opinion, because it's dead simple and quite powerful and it does not need getting back to JOINs for getting info on last build on branch etc.

I will also push a small change in the API to start pushing `branches` as an array (but I will leave `branch` as an alternative for backwards compatibility).