version: 1.0.{build}

image: Visual Studio 2013

platform:
  - x64

services:
  - mssql2012sp1
  - mysql
  - postgresql

shallow_clone: true

cache:
  - node_modules

environment:
  global:
    PGUSER: postgres
    PGPASSWORD: Password12!
    MYSQL_PWD: Password12!
    DIALECT: mssql

  matrix:
    - {NODE_VERSION: 4, DIALECT: mssql}
    - {NODE_VERSION: 6, DIALECT: mssql}

install:
  - ps: Install-Product node $env:NODE_VERSION x64
  - ps: |
      $pkg = ConvertFrom-Json (Get-Content -Raw package.json)
      $pkg.devDependencies.PSObject.Properties.Remove('sqlite3')
      $pkg.devDependencies.PSObject.Properties.Remove('pg-native')
      ConvertTo-Json $pkg | Out-File package.json -Encoding UTF8
  - npm install

build: off

before_test:
  - ps: sqlcmd -S "(local)" -U "sa" -P "Password12!" -d "master" -Q "CREATE DATABASE [sequelize_auto_test]; ALTER DATABASE [sequelize_auto_test] SET READ_COMMITTED_SNAPSHOT ON;"
  # setup pg databases
  - SET PATH=C:\Program Files\PostgreSQL\9.5\bin;%PATH%
  - createdb sequelize_auto_test
  # setup mysql databases
  - SET PATH=C:\Program Files\MySQL\MySQL Server 5.7\bin;C:\Program Files\MySQL\MySQL Server 5.7\lib;%PATH%
  - mysql -e "create database sequelize_auto_test;" -uroot

test_script:
  - npm test

branches:
  only:
    - master
