philpeble-update-old-migrations-for-json-type-flexibility Update migrations to allow for json type flexibility

The README states that we need to maintain compatibility with
postgres 9.3, however there are three migrations that use the
`jsonb` type. This type was added in 9.4, which means running
these migrations on 9.3 will result in an error.

This updates three older migrations from 2018 to choose the
correct json type depending on the target postgres version.
It will choose 'json' for 9.3 and 'jsonb' for 9.4 or newer.

The helper method to do this already existed and is used
in other migrations. These specific migrations must have been missed.

Phil Peble avatar Phil Peble

Push event #1190.1 passed

  • Ran for
AMD64
Ruby: 2.5.1
Git
RAILS_ENV=test
language: ruby
sudo: false

services:
  - postgresql

addons:
  postgresql: "9.6"

cache:
  directories:
    - vendor/bundle

rvm: "2.5.1"

env:
  - RAILS_ENV=test

script:
  - bundle exec rspec spec
  - script/validate_structure_file.rb db/main/structure-original.sql

before_script:
  - cp db/main/structure.sql db/main/structure-original.sql
  - cp config/database.yml.travis config/database.yml

after_success:
  - script/upload_structure.rb
Build Config
{
  "os": [
    "linux"
  ],
  "env": {
    "matrix": [
      "RAILS_ENV=test"
    ]
  },
  "rvm": [
    "2.5.1"
  ],
  "dist": "trusty",
  "sudo": false,
  "cache": {
    "directories": [
      "vendor/bundle"
    ]
  },
  "addons": {
    "postgresql": "9.6"
  },
  "script": [
    "bundle exec rspec spec",
    "script/validate_structure_file.rb db/main/structure-original.sql"
  ],
  "language": "ruby",
  "services": [
    "postgresql"
  ],
  "after_success": [
    "script/upload_structure.rb"
  ],
  "before_script": [
    "cp db/main/structure.sql db/main/structure-original.sql",
    "cp config/database.yml.travis config/database.yml"
  ]
}