pg_ha_migrations 1.2.3 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae8983eec2507ce164936c65c32a7c296d0d3ef338ada2d90d68f37c572d00f7
4
- data.tar.gz: 9c07cb77837a23a603e713e94cdae71f26acce82dbc2332d6fd77260c54d7c8c
3
+ metadata.gz: 05dbece254aee14a92945662e8af6ef7a0a94a871b55f21f527c8b277c9ec543
4
+ data.tar.gz: b744971a9a2616b41c78dacd4f6d912a97ca4e3b0799b87fbcc9823d7da11213
5
5
  SHA512:
6
- metadata.gz: 247dd7ac257a208ef985d86b94710fbf41c0e622d02ce1acecb46d490ab17adb6aa080060d6e48ddf56e8ef4a5289121dcf4edd41e83f3bb7418ce20cfc91d4c
7
- data.tar.gz: 0f0fb4ac98e6732d7d020a55e0f2608e256dbf34b4fe669ccfcde7e1878df43b3ccd8e153af61e6681d5eec62b8269ea435303376136207af54341d8bb19da41
6
+ metadata.gz: 7a6ed6c77b7106354a2f9a78545aae555145f9aac8d851e61be20d54bdaa283858646fe4f03172bb39836919aa942e8caa3854a48146caffeebf0c9bcfe48e03
7
+ data.tar.gz: b502c70bdc1eebda9e152bea35f1e8d000daa55b592d043eb5ae3f0bde347c459f60c83d31c6f000f741ff4d5b953ed8e3bcd70b0e4488288a3cc9b7657a9246
@@ -0,0 +1,42 @@
1
+ name: CI
2
+ on: [push, pull_request]
3
+ jobs:
4
+ test:
5
+ strategy:
6
+ matrix:
7
+ pg:
8
+ - 9.6
9
+ - 10
10
+ - 11
11
+ - 12
12
+ gemfile:
13
+ - rails_5.0
14
+ - rails_5.1
15
+ - rails_5.2
16
+ - rails_6.0
17
+ - rails_6.1
18
+ name: PostgreSQL ${{ matrix.pg }}
19
+ runs-on: ubuntu-latest
20
+ env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
21
+ BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
22
+ ImageOS: ubuntu20
23
+ services:
24
+ postgresql:
25
+ image: postgres:${{ matrix.pg }}
26
+ env:
27
+ POSTGRES_PASSWORD: postgres
28
+ # Set health checks to wait until postgres has started
29
+ options: >-
30
+ --health-cmd pg_isready
31
+ --health-interval 10s
32
+ --health-timeout 5s
33
+ --health-retries 5
34
+ ports:
35
+ - 5432:5432
36
+ steps:
37
+ - uses: actions/checkout@v2
38
+ - name: Setup Ruby using .ruby-version file
39
+ uses: ruby/setup-ruby@v1
40
+ with:
41
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
42
+ - run: bundle exec rake spec
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.5.7
1
+ ruby-2.7
data/Appraisals CHANGED
@@ -14,3 +14,7 @@ appraise "rails-6.0" do
14
14
  gem "rails", "6.0.0"
15
15
  end
16
16
 
17
+ appraise "rails-6.1" do
18
+ gem "rails", "6.1.0"
19
+ end
20
+
data/README.md CHANGED
@@ -55,7 +55,7 @@ There are two major classes of concerns we try to handle in the API:
55
55
 
56
56
  We rename migration methods with prefixes denoting their safety level:
57
57
 
58
- - `safe_*`: These methods check for both application and database safety concerns prefer concurrent operations where available, set low lock timeouts where appropriate, and decompose operations into multiple safe steps.
58
+ - `safe_*`: These methods check for both application and database safety concerns, prefer concurrent operations where available, set low lock timeouts where appropriate, and decompose operations into multiple safe steps.
59
59
  - `unsafe_*`: These methods are generally a direct dispatch to the native ActiveRecord migration method.
60
60
 
61
61
  Calling the original migration methods without a prefix will raise an error.
@@ -106,6 +106,18 @@ Safely add a new enum value.
106
106
  safe_add_enum_value :enum, "value"
107
107
  ```
108
108
 
109
+ #### unsafe\_rename\_enum\_value
110
+
111
+ Unsafely change the value of an enum type entry.
112
+
113
+ ```ruby
114
+ unsafe_rename_enum_value(:enum, "old_value", "new_value")
115
+ ```
116
+
117
+ Note:
118
+
119
+ Changing an enum value does not issue any long-running scans or acquire locks on usages of the enum type. Therefore multiple queries within a transaction concurrent with the change may see both the old and new values. To highlight these potential pitfalls no `safe_rename_enum_value` equivalent exists. Before modifying an enum type entry you should verify that no concurrently executing queries will attempt to write the old value and that read queries understand the new value.
120
+
109
121
  #### safe\_add\_column
110
122
 
111
123
  Safely add a column.
@@ -136,6 +148,8 @@ safe_change_column_default :table, :column, -> { "NOW()" }
136
148
  safe_change_column_default :table, :column, -> { "'NOW()'" }
137
149
  ```
138
150
 
151
+ Note: On Postgres 11+ adding a column with a constant default value does not rewrite or scan the table (under a lock or otherwise). In that case a migration adding a column with a default should do so in a single operation rather than the two-step `safe_add_column` followed by `safe_change_column_default`. We enforce this best practice with the error `PgHaMigrations::BestPracticeError`, but if your prefer otherwise (or are running in a mixed Postgres version environment), you may opt out by setting `config.prefer_single_step_column_addition_with_default = true` [in your configuration initializer](#configuration).
152
+
139
153
  #### safe\_make\_column\_nullable
140
154
 
141
155
  Safely make the column nullable.
@@ -260,6 +274,8 @@ end
260
274
 
261
275
  - `disable_default_migration_methods`: If true, the default implementations of DDL changes in `ActiveRecord::Migration` and the PostgreSQL adapter will be overridden by implementations that raise a `PgHaMigrations::UnsafeMigrationError`. Default: `true`
262
276
  - `check_for_dependent_objects`: If true, some `unsafe_*` migration methods will raise a `PgHaMigrations::UnsafeMigrationError` if any dependent objects exist. Default: `false`
277
+ - `prefer_single_step_column_addition_with_default`: If `true`, raise an error when adding a column and separately setting a constant default value for that column in the same migration. Default: `false`
278
+ - 'allow_force_create_table`: If false, the `force: true` option to ActiveRecord's `create_table` method is disallowed. Default: `true`
263
279
 
264
280
  ### Rake Tasks
265
281
 
@@ -283,11 +299,15 @@ Rake::Task["pg_ha_migrations:check_blocking_database_transactions"].enhance ["db
283
299
 
284
300
  ## Development
285
301
 
286
- After checking out the repo, run `bin/setup` to install dependencies and start a postgres docker container. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
302
+ After checking out the repo, run `bin/setup` to install dependencies and start a postgres docker container. Then, run `bundle exec rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. This project uses Appraisal to test against multiple versions of ActiveRecord; you can run the tests against all supported version with `bundle exec appraisal rspec`.
287
303
 
288
304
  Running tests will automatically create a test database in the locally running Postgres server. You can find the connection parameters in `spec/spec_helper.rb`, but setting the environment variables `PGHOST`, `PGPORT`, `PGUSER`, and `PGPASSWORD` will override the defaults.
289
305
 
290
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
306
+ To install this gem onto your local machine, run `bundle exec rake install`.
307
+
308
+ To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
309
+
310
+ Note: if while releasing the gem you get the error `Your rubygems.org credentials aren't set. Run \`gem push\` to set them.` you can more simply run `gem signin`.
291
311
 
292
312
  ## Contributing
293
313
 
data/bin/setup CHANGED
@@ -2,10 +2,14 @@
2
2
  set -euo pipefail
3
3
  IFS=$'\n\t'
4
4
  set -vx
5
+ export PGPASSWORD="${PGPASSWORD:-postgres}"
6
+ PGVERSION="${PGVERSION:-13}"
7
+
5
8
 
6
9
  bundle install
10
+ bundle exec appraisal install
7
11
 
8
12
  # Do any other automated setup that you need to do here
9
13
 
10
14
  # Launch a blank postgres image for testing
11
- docker run -d -p 127.0.0.1:5432:5432 postgres:10
15
+ docker run -d -p 127.0.0.1:5432:5432 -e POSTGRES_PASSWORD="${PGPASSWORD}" postgres:${PGVERSION}
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "6.1.0"
6
+
7
+ gemspec path: "../"
@@ -1,7 +1,7 @@
1
1
  require "active_record/migration/compatibility"
2
2
 
3
3
  module PgHaMigrations::AllowedVersions
4
- ALLOWED_VERSIONS = [4.2, 5.0, 5.1, 5.2, 6.0].map do |v|
4
+ ALLOWED_VERSIONS = [4.2, 5.0, 5.1, 5.2, 6.0, 6.1].map do |v|
5
5
  begin
6
6
  ActiveRecord::Migration[v]
7
7
  rescue ArgumentError
@@ -49,10 +49,6 @@ module PgHaMigrations
49
49
  LEFT JOIN pg_class c ON ( -- Database wide
50
50
  l.locktype = 'relation'
51
51
  AND l.relation = c.oid
52
- -- Be explicit about this being for a single database -- it's already implicit in
53
- -- the relations used, and if we don't restrict this we could get incorrect results
54
- -- with oid collisions from pg_namespace and pg_class.
55
- AND l.database = (SELECT d.oid FROM pg_database d WHERE d.datname = current_database())
56
52
  )
57
53
  LEFT JOIN pg_namespace ns ON (c.relnamespace = ns.oid) -- Database wide
58
54
  WHERE psa.#{pid_column} != pg_backend_pid()
@@ -65,6 +61,10 @@ module PgHaMigrations
65
61
  )
66
62
  AND psa.xact_start < clock_timestamp() - ?::interval
67
63
  AND psa.#{query_column} !~ ?
64
+ -- Be explicit about this being for a single database -- it's already implicit in
65
+ -- the relations used, and if we don't restrict this we could get incorrect results
66
+ -- with oid collisions from pg_namespace and pg_class.
67
+ AND psa.datname = current_database()
68
68
  #{postgres_version >= 10_00_00 ? "AND #{ignore_sqlsender_sql}" : ""}
69
69
  GROUP BY psa.datname, psa.#{query_column}, psa.state, psa.xact_start
70
70
  SQL
@@ -1,4 +1,8 @@
1
1
  module PgHaMigrations::SafeStatements
2
+ def safe_added_columns_without_default_value
3
+ @safe_added_columns_without_default_value ||= []
4
+ end
5
+
2
6
  def safe_create_table(table, options={}, &block)
3
7
  if options[:force]
4
8
  raise PgHaMigrations::UnsafeMigrationError.new(":force is NOT SAFE! Explicitly call unsafe_drop_table first if you want to recreate an existing table")
@@ -25,14 +29,37 @@ module PgHaMigrations::SafeStatements
25
29
  unsafe_execute("ALTER TYPE #{PG::Connection.quote_ident(name.to_s)} ADD VALUE '#{PG::Connection.escape_string(value)}'")
26
30
  end
27
31
 
28
- def safe_add_column(table, column, type, options = {})
29
- if options.has_key? :default
30
- raise PgHaMigrations::UnsafeMigrationError.new(":default is NOT SAFE! Use safe_change_column_default afterwards then backfill the data to prevent locking the table")
32
+ def unsafe_rename_enum_value(name, old_value, new_value)
33
+ if ActiveRecord::Base.connection.postgresql_version < 10_00_00
34
+ raise PgHaMigrations::InvalidMigrationError, "Renaming an enum value is not supported on Postgres databases before version 10"
31
35
  end
32
- if options[:null] == false
36
+
37
+ unsafe_execute("ALTER TYPE #{PG::Connection.quote_ident(name.to_s)} RENAME VALUE '#{PG::Connection.escape_string(old_value)}' TO '#{PG::Connection.escape_string(new_value)}'")
38
+ end
39
+
40
+ def safe_add_column(table, column, type, options = {})
41
+ # Note: we don't believe we need to consider the odd case where
42
+ # `:default => nil` or `:default => -> { null }` (or similar) is
43
+ # passed because:
44
+ # - It's OK to exclude that case with an "unnecessary" `raise`
45
+ # below as it doesn't make semantic sense anyway.
46
+ # - If `:null => false` is also passed we are assuming Postgres's
47
+ # seq scan of the table (to verify the NOT NULL constraint) will
48
+ # short-circuit (though we have not confirmed that).
49
+ if options.has_key?(:default)
50
+ if ActiveRecord::Base.connection.postgresql_version < 11_00_00
51
+ raise PgHaMigrations::UnsafeMigrationError.new(":default is NOT SAFE! Use safe_change_column_default afterwards then backfill the data to prevent locking the table")
52
+ elsif options[:default].is_a?(Proc) || (options[:default].is_a?(String) && !([:string, :text, :binary].include?(type.to_sym) || _type_is_enum(type)))
53
+ raise PgHaMigrations::UnsafeMigrationError.new(":default is not safe if the default value is volatile. Use safe_change_column_default afterwards then backfill the data to prevent locking the table")
54
+ end
55
+ elsif options[:null] == false
33
56
  raise PgHaMigrations::UnsafeMigrationError.new(":null => false is NOT SAFE if the table has data! If you _really_ want to do this, use unsafe_make_column_not_nullable")
34
57
  end
35
58
 
59
+ unless options.has_key?(:default)
60
+ self.safe_added_columns_without_default_value << [table.to_s, column.to_s]
61
+ end
62
+
36
63
  unsafe_add_column(table, column, type, options)
37
64
  end
38
65
 
@@ -43,6 +70,12 @@ module PgHaMigrations::SafeStatements
43
70
  end
44
71
 
45
72
  def safe_change_column_default(table_name, column_name, default_value)
73
+ if PgHaMigrations.config.prefer_single_step_column_addition_with_default &&
74
+ ActiveRecord::Base.connection.postgresql_version >= 11_00_00 &&
75
+ self.safe_added_columns_without_default_value.include?([table_name.to_s, column_name.to_s])
76
+ raise PgHaMigrations::BestPracticeError, "On Postgres 11+ it's safe to set a constant default value when adding a new column; please set the default value as part of the column addition"
77
+ end
78
+
46
79
  column = connection.send(:column_for, table_name, column_name)
47
80
 
48
81
  # In 5.2 we have an edge whereby passing in a string literal with an expression
@@ -201,6 +234,10 @@ module PgHaMigrations::SafeStatements
201
234
  raise PgHaMigrations::UnsupportedAdapter, "This gem only works with the #{expected_adapter} adapter, found #{actual_adapter} instead" unless actual_adapter == expected_adapter
202
235
  end
203
236
 
237
+ def _type_is_enum(type)
238
+ ActiveRecord::Base.connection.select_values("SELECT typname FROM pg_type JOIN pg_enum ON pg_type.oid = pg_enum.enumtypid").include?(type.to_s)
239
+ end
240
+
204
241
  def migrate(direction)
205
242
  if respond_to?(:change)
206
243
  raise PgHaMigrations::UnsupportedMigrationError, "Tracking changes for automated rollback is not supported; use explicit #up instead."
@@ -39,7 +39,6 @@ module PgHaMigrations::UnsafeStatements
39
39
  delegate_unsafe_method_to_migration_base_class :change_column
40
40
  delegate_unsafe_method_to_migration_base_class :change_column_default
41
41
  delegate_unsafe_method_to_migration_base_class :remove_column
42
- delegate_unsafe_method_to_migration_base_class :add_index
43
42
  delegate_unsafe_method_to_migration_base_class :execute
44
43
  delegate_unsafe_method_to_migration_base_class :remove_index
45
44
  delegate_unsafe_method_to_migration_base_class :add_foreign_key
@@ -69,6 +68,16 @@ module PgHaMigrations::UnsafeStatements
69
68
  execute_ancestor_statement(:create_table, table, options, &block)
70
69
  end
71
70
 
71
+ def unsafe_add_index(table, column_names, options = {})
72
+ if ((ActiveRecord::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR >= 2) || ActiveRecord::VERSION::MAJOR > 5) &&
73
+ column_names.is_a?(String) && /\W/.match?(column_names) && options.key?(:opclass)
74
+ raise PgHaMigrations::InvalidMigrationError, "ActiveRecord drops the :opclass option when supplying a string containing an expression or list of columns; instead either supply an array of columns or include the opclass in the string for each column"
75
+ end
76
+
77
+ execute_ancestor_statement(:add_index, table, column_names, options)
78
+ end
79
+
80
+
72
81
  def execute_ancestor_statement(method_name, *args, &block)
73
82
  # Dispatching here is a bit complicated: we need to execute the method
74
83
  # belonging to the first member of the inheritance chain (besides
@@ -1,3 +1,3 @@
1
1
  module PgHaMigrations
2
- VERSION = "1.2.3"
2
+ VERSION = "1.4.0"
3
3
  end
@@ -8,14 +8,16 @@ module PgHaMigrations
8
8
  Config = Struct.new(
9
9
  :disable_default_migration_methods,
10
10
  :check_for_dependent_objects,
11
- :allow_force_create_table
11
+ :allow_force_create_table,
12
+ :prefer_single_step_column_addition_with_default
12
13
  )
13
14
 
14
15
  def self.config
15
16
  @config ||= Config.new(
16
17
  true,
17
18
  false,
18
- true
19
+ true,
20
+ false
19
21
  )
20
22
  end
21
23
 
@@ -29,18 +31,24 @@ module PgHaMigrations
29
31
  # Safe versus unsafe in this context specifically means the following:
30
32
  # - Safe operations will not block for long periods of time.
31
33
  # - Unsafe operations _may_ block for long periods of time.
32
- UnsafeMigrationError = Class.new(Exception)
34
+ UnsafeMigrationError = Class.new(StandardError)
33
35
 
34
36
  # Invalid migrations are operations which we expect to not function
35
37
  # as expected or get the schema into an inconsistent state
36
- InvalidMigrationError = Class.new(Exception)
38
+ InvalidMigrationError = Class.new(StandardError)
39
+
40
+ # Operations violating a best practice, but not actually unsafe will
41
+ # raise this error. For example, adding a column without a default and
42
+ # then setting its default in a second action in a single migration
43
+ # isn't our documented best practice and will raise this error.
44
+ BestPracticeError = Class.new(Exception)
37
45
 
38
46
  # Unsupported migrations use ActiveRecord::Migration features that
39
47
  # we don't support, and therefore will likely have unexpected behavior.
40
- UnsupportedMigrationError = Class.new(Exception)
48
+ UnsupportedMigrationError = Class.new(StandardError)
41
49
 
42
50
  # This gem only supports the PostgreSQL adapter at this time.
43
- UnsupportedAdapter = Class.new(Exception)
51
+ UnsupportedAdapter = Class.new(StandardError)
44
52
  end
45
53
 
46
54
  require "pg_ha_migrations/blocking_database_transactions"
@@ -32,11 +32,11 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency "rake", "~> 10.0"
33
33
  spec.add_development_dependency "rspec", "~> 3.0"
34
34
  spec.add_development_dependency "pg"
35
- spec.add_development_dependency "db-query-matchers", "~> 0.9.0"
35
+ spec.add_development_dependency "db-query-matchers", "~> 0.10.0"
36
36
  spec.add_development_dependency "pry"
37
37
  spec.add_development_dependency "pry-byebug"
38
38
  spec.add_development_dependency "appraisal", "~> 2.2.0"
39
39
 
40
- spec.add_dependency "rails", ">= 5.0", "< 6.1"
40
+ spec.add_dependency "rails", ">= 5.0", "< 6.2"
41
41
  spec.add_dependency "relation_to_struct", ">= 1.5.1"
42
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_ha_migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - celeen
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: exe
16
16
  cert_chain: []
17
- date: 2020-03-12 00:00:00.000000000 Z
17
+ date: 2022-01-10 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rake
@@ -64,14 +64,14 @@ dependencies:
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: 0.9.0
67
+ version: 0.10.0
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: 0.9.0
74
+ version: 0.10.0
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: pry
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -123,7 +123,7 @@ dependencies:
123
123
  version: '5.0'
124
124
  - - "<"
125
125
  - !ruby/object:Gem::Version
126
- version: '6.1'
126
+ version: '6.2'
127
127
  type: :runtime
128
128
  prerelease: false
129
129
  version_requirements: !ruby/object:Gem::Requirement
@@ -133,7 +133,7 @@ dependencies:
133
133
  version: '5.0'
134
134
  - - "<"
135
135
  - !ruby/object:Gem::Version
136
- version: '6.1'
136
+ version: '6.2'
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: relation_to_struct
139
139
  requirement: !ruby/object:Gem::Requirement
@@ -156,11 +156,11 @@ executables: []
156
156
  extensions: []
157
157
  extra_rdoc_files: []
158
158
  files:
159
+ - ".github/workflows/ci.yml"
159
160
  - ".gitignore"
160
161
  - ".pryrc"
161
162
  - ".rspec"
162
163
  - ".ruby-version"
163
- - ".travis.yml"
164
164
  - Appraisals
165
165
  - CODE_OF_CONDUCT.md
166
166
  - Gemfile
@@ -174,6 +174,7 @@ files:
174
174
  - gemfiles/rails_5.1.gemfile
175
175
  - gemfiles/rails_5.2.gemfile
176
176
  - gemfiles/rails_6.0.gemfile
177
+ - gemfiles/rails_6.1.gemfile
177
178
  - lib/pg_ha_migrations.rb
178
179
  - lib/pg_ha_migrations/allowed_versions.rb
179
180
  - lib/pg_ha_migrations/blocking_database_transactions.rb
@@ -206,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
207
  - !ruby/object:Gem::Version
207
208
  version: '0'
208
209
  requirements: []
209
- rubygems_version: 3.0.8
210
+ rubygems_version: 3.1.4
210
211
  signing_key:
211
212
  specification_version: 4
212
213
  summary: Enforces DDL/migration safety in Ruby on Rails project with an emphasis on
data/.travis.yml DELETED
@@ -1,28 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5
5
- global:
6
- env:
7
- PGPORT: 5433
8
- env:
9
- - PGVERSION: "9.6"
10
- - PGVERSION: "10"
11
- - PGVERSION: "11"
12
- - PGVERSION: "12"
13
- services:
14
- - postgresql
15
- before_install:
16
- - sudo service postgresql stop
17
- - sudo apt-get update
18
- - sudo apt-get -y install postgresql-$PGVERSION postgresql-client-$PGVERSION postgresql-server-dev-$PGVERSION postgresql-client-common postgresql-common
19
- - if [ $PGVERSION != '9.6' ]; then sudo cp /etc/postgresql/{9.6,$PGVERSION}/main/pg_hba.conf; fi
20
- - sudo service postgresql restart $PGVERSION
21
- - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
22
- - gem install bundler -v 1.15.4
23
- gemfile:
24
- - gemfiles/rails_5.0.gemfile
25
- - gemfiles/rails_5.1.gemfile
26
- - gemfiles/rails_5.2.gemfile
27
- - gemfiles/rails_6.0.gemfile
28
- script: "bundle exec rake spec"