language: c

services:
  - postgresql

addons:
  postgresql: "9.4"

before_script:
  - chmod +x ./test.sh
  - psql -U postgres -c 'CREATE DATABASE pgtest;'
  - psql -d pgtest -U postgres < pgtest.sql
  - psql -d pgtest -U postgres < pgtest_test.sql

script:
  - ./test.sh
language: c

before_install:
  - psql --version
  - sudo /etc/init.d/postgresql stop
  - sudo apt-get -y --purge remove postgresql libpq-dev libpq5 postgresql-client-common postgresql-common
  - sudo rm -rf /var/lib/postgresql
  - wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
  - sudo sh -c "echo deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main $PGVERSION >> /etc/apt/sources.list.d/postgresql.list"
  - sudo apt-get update -qq
  - sudo apt-get -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::="--force-confnew" install postgresql-$PGVERSION postgresql-server-dev-$PGVERSION postgresql-common
  - sudo chmod 777 /etc/postgresql/$PGVERSION/main/pg_hba.conf
  - sudo echo "local   all         postgres                          trust" > /etc/postgresql/$PGVERSION/main/pg_hba.conf
  - sudo echo "local   all         all                               trust" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
  - sudo echo "host    all         all         127.0.0.1/32          trust" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
  - sudo echo "host    all         all         ::1/128               trust" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
  - sudo /etc/init.d/postgresql restart

before_script:
  - chmod +x ./test.sh
  - psql -U postgres -c 'CREATE DATABASE pgtest;'
  - psql -d pgtest -U postgres < pgtest.sql
  - psql -d pgtest -U postgres < pgtest_test.sql

env:
  - PGVERSION=9.0
  - PGVERSION=9.1
  - PGVERSION=9.2
  - PGVERSION=9.3
  - PGVERSION=9.4
  - PGVERSION=9.5
  - PGVERSION=9.6

script:
  - ./test.sh
Test against different database versions.
Test against different database versions.
