database: use an ephemeral postgres for test
Created by: keegancsmith
Instead of using the system postgres, we can use an ephemeral postgres which is tuned for performance on ephemeral data. The main optimization here is turning off file syncing. On my system the runtime for "go test ./internal/database" goes from 78s to 4s.
I quite like this approach and believe we should always use it for tests, rather than optionally. This removes the requirement of having postgres running and configured for access. For this initial commit I just focussed on not breaking existing use cases and only doing it for our slowest package.
The code for this is based on pg_tmp. There is also integresql which uses a daemon based approach where each test case can get its own DB. That may be an interesting future direction.