version: 2
jobs:
  build:
    docker:
      - image: circleci/node:10.15
        environment:
          C_DB_URL: postgres://livemap@localhost:5432/livemapdb

      - image: circleci/postgres:9.6
        environment:
          POSTGRES_USER: postgres
    working_directory: ~/repo

    steps:
      - checkout

      - run:
          name: Wait for DB
          command: dockerize -wait tcp://localhost:5432 -timeout 1m

      - run:
          name: Install PostgreSQL client
          command: |
            sudo apt-get install postgresql-client

      - run:
          name: Initialise DB
          command: |
            psql -h localhost -p 5432 -U postgres < initdb/10_init-user-db.sql

      - run:
          name: Create tables
          command: |
            psql -h localhost -p 5432 -U livemap -d livemapdb < setup/schema.sql

      - run:
          name: Install packages
          command: npm install

      - run:
          name: Run tests
          command: npm test

version: 2
jobs:
  build:
    docker:
      - image: circleci/node:10.15
        environment:
          C_DB_URL: postgres://livemap@localhost:5432/livemapdb

      - image: circleci/postgres:9.6
        environment:
          POSTGRES_USER: postgres
    working_directory: ~/repo

    steps:
      - checkout

      - run:
          name: Wait for DB
          command: dockerize -wait tcp://localhost:5432 -timeout 1m

      - run:
          name: Install PostgreSQL client
          command: |
            sudo apt-get update && sudo apt-get install postgresql-client

      - run:
          name: Initialise DB
          command: |
            psql -h localhost -p 5432 -U postgres < initdb/10_init-user-db.sql

      - run:
          name: Create tables
          command: |
            psql -h localhost -p 5432 -U livemap -d livemapdb < setup/schema.sql

      - run:
          name: Install packages
          command: npm install

      - run:
          name: Run tests
          command: npm test

Fix missing apt-get update in CircleCI script
Fix missing apt-get update in CircleCI script
