Using the latest Postgres in Circle-CI

Oct 5, 2016

postgres, sql, ci, testing

Postgres is included in the base image of Circle-CI, however, sometimes you need a feature such as jsonb_set that is only available from 9.5 and above.

So you have no other choice but to upgrade to the latest version, luckily the steps are very straightforward:

    - sudo apt-get remove --purge postgresql postgresql-9.4
    - sudo sh -c 'echo "deb `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
    - wget -q -O - | sudo apt-key add -
    - sudo apt-get update
    - sudo apt-get install postgresql postgresql-contrib
    - sudo service postgresql start