departure-next 6.7.1.pre.1 → 6.7.1.pre.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c1d7cf38846a2dc5a98b2eba8f5e237339d260d2236016fad992269ce6663af
4
- data.tar.gz: a5dc7e4de150b5899364f1705b7ea6fb2e1ebf4beda29d0431b1362220947085
3
+ metadata.gz: eb07f8bac571af6678ddf42ba37b0bafb8fabc1513ef7b7d7a93f6e54d4ec331
4
+ data.tar.gz: 800578f8114c7938e58c83ea2fa07500182446b6fe1ff07bd1f994b9f9d44d7f
5
5
  SHA512:
6
- metadata.gz: fa7e89146d41e63afccb7b8e4ee2e0f310c3d6b6261393ca71b8f0ba289e61c8465a4b672460bfe0766927511b009629ea3b7cde4550e2ea9540d6c7a2cd4ed8
7
- data.tar.gz: 5453515385df640e578a0a78a56b28ed8f7d7e3be9abbc0c295f3a5a93b0f38c24c871e88b43369fc17e357d6961b67abe733f20140ec90073927ad4bede61a0
6
+ metadata.gz: 6d4f66a78dd3af2f9087f4d0b29708eb31c61f5165ae61bb2bba11dcca1f282483dafbb9de4cd05498ce5576f3c9e2c3b1ec3b1426f863ea137be8fc03d098d3
7
+ data.tar.gz: 84dc1c70cd57f48906f4b405f6a65295eb74af00921d05f0b88292a16742408a52dae68e62634731f8f45e04a73e89654bbbbad60fc716b030a1320f7aa5533a
data/.rubocop.yml CHANGED
@@ -6,7 +6,7 @@ require:
6
6
  - rubocop-performance
7
7
 
8
8
  AllCops:
9
- TargetRubyVersion: 2.4
9
+ TargetRubyVersion: 3.1.x
10
10
 
11
11
  Metrics/AbcSize:
12
12
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -11,8 +11,10 @@ Please follow the format in [Keep a Changelog](http://keepachangelog.com/)
11
11
  - Create a `bin/rails` command that loads the database from the dummy application
12
12
  - Create a RailsAdapter that will handle creating connections inside of different versions of rails
13
13
  - Implement a Rails72DeparatureAdapater that handles the differences between Rails 7.2 and other rails versions
14
+ - Implement a ActiveRecordMigratorWithAdvisoryLock for ActiveRecord versions 7.1 and 7.2 to prevent ConcurrentMigrationErrors
15
+ - Implement a configuration option `disable_rails_advisory_lock_patch` to disable the ActiveRecordMigratorWithAdvisoryLock patch in our gem
14
16
 
15
- ## [6.7.0] - 2024-02-20
17
+ ## [6.7.1.pre.2] - 2024-02-20
16
18
 
17
19
  - Flex mysql2 dependency to < 0.6 and bump version to 0.5.6
18
20
  - Drop support for older than the latest EOL Ruby (2.7) and Rails (6.0)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- departure-next (6.7.1.pre.1)
4
+ departure (6.7.1.pre.2)
5
5
  activerecord (>= 6.0.0, < 7.3.0, != 7.0.0)
6
6
  mysql2 (>= 0.4.0, < 0.6.0)
7
7
  railties (>= 6.0.0, < 7.3.0, != 7.0.0)
@@ -81,6 +81,8 @@ GEM
81
81
  minitest (5.22.2)
82
82
  mutex_m (0.2.0)
83
83
  mysql2 (0.5.6)
84
+ nokogiri (1.18.3-arm64-darwin)
85
+ racc (~> 1.4)
84
86
  nokogiri (1.18.3-x86_64-linux-gnu)
85
87
  racc (~> 1.4)
86
88
  parallel (1.26.3)
@@ -188,7 +190,7 @@ DEPENDENCIES
188
190
  base64
189
191
  climate_control (~> 0.0.3)
190
192
  codeclimate-test-reporter (~> 1.0.3)
191
- departure-next!
193
+ departure!
192
194
  lhm
193
195
  logger
194
196
  mutex_m
data/README.md CHANGED
@@ -147,6 +147,14 @@ end
147
147
  It's strongly recommended to name it after this gems name, such as
148
148
  `config/initializers/departure.rb`
149
149
 
150
+ ### Configuration Options
151
+
152
+ All configuration options are configurable from the `Departure.configure` block example below
153
+
154
+ |Option|Default|What it Controls|
155
+ |---|---|---|
156
+ |disable_rails_advisory_lock_patch|false|When truthy, disables a patch in at least rails 7.1 and 7.2 where rails throws ConcurrentMigrationErrors due to the inability to release the advisory lock in migrations|
157
+
150
158
  ### Disable on per-migration basis
151
159
 
152
160
  Departure gem is enabled by default.
data/config.yml.erb CHANGED
@@ -1,5 +1,5 @@
1
1
  username: <%= ENV['PERCONA_DB_USER'] || 'root' %>
2
- password: <%= ENV['PERCONA_DB_PASSWORD'] || '' %>
2
+ password: <%= ENV['PERCONA_DB_PASSWORD'] || 'password' %>
3
3
  database: <%= ENV['PERCONA_DB_NAME'] || 'departure_test' %>
4
4
  hostname: <%= ENV['PERCONA_DB_HOST'] || 'localhost' %>
5
5
  socket: <%= ENV['PERCONA_DB_SOCKET'] || '' %>
data/departure.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
 
14
14
  spec.summary = %q(pt-online-schema-change runner for ActiveRecord migrations)
15
15
  spec.description = %q(Execute your ActiveRecord migrations with Percona's pt-online-schema-change. Formerly known as Percona Migrator.)
16
- spec.homepage = 'https://github.com/departurerb/departure'
16
+ spec.homepage = 'https://github.com/austio/departure'
17
17
  spec.license = 'MIT'
18
18
 
19
19
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
@@ -1,10 +1,14 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
- gem 'codeclimate-test-reporter', '~> 1.0.3', group: :test, require: nil
6
- gem 'rails', '6.1.7.6'
7
- gem 'rubocop', '~> 1.60.2', require: false
8
- gem 'rubocop-performance', '~> 1.20.2', require: false
5
+ gem "base64"
6
+ gem "codeclimate-test-reporter", "~> 1.0.3", group: :test, require: nil
7
+ gem "lhm"
8
+ gem "logger"
9
+ gem "mutex_m", require: false
10
+ gem "rubocop", "~> 1.74.0", require: false
11
+ gem "rubocop-performance", "~> 1.20.2", require: false
12
+ gem "rails", "6.1.7.6"
9
13
 
10
- gemspec path: '../'
14
+ gemspec path: "../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- departure (6.7.0)
4
+ departure (6.7.1.pre.2)
5
5
  activerecord (>= 6.0.0, < 7.3.0, != 7.0.0)
6
6
  mysql2 (>= 0.4.0, < 0.6.0)
7
7
  railties (>= 6.0.0, < 7.3.0, != 7.0.0)
@@ -1,10 +1,14 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
- gem 'codeclimate-test-reporter', '~> 1.0.3', group: :test, require: nil
6
- gem 'rails', '7.0.8'
7
- gem 'rubocop', '~> 1.60.2', require: false
8
- gem 'rubocop-performance', '~> 1.20.2', require: false
5
+ gem "base64"
6
+ gem "codeclimate-test-reporter", "~> 1.0.3", group: :test, require: nil
7
+ gem "lhm"
8
+ gem "logger"
9
+ gem "mutex_m", require: false
10
+ gem "rubocop", "~> 1.74.0", require: false
11
+ gem "rubocop-performance", "~> 1.20.2", require: false
12
+ gem "rails", "7.0.8"
9
13
 
10
- gemspec path: '../'
14
+ gemspec path: "../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- departure (6.7.0)
4
+ departure (6.7.1.pre.2)
5
5
  activerecord (>= 6.0.0, < 7.3.0, != 7.0.0)
6
6
  mysql2 (>= 0.4.0, < 0.6.0)
7
7
  railties (>= 6.0.0, < 7.3.0, != 7.0.0)
@@ -1,10 +1,14 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
- gem 'codeclimate-test-reporter', '~> 1.0.3', group: :test, require: nil
6
- gem 'rails', '7.1.3'
7
- gem 'rubocop', '~> 1.74.0', require: false
8
- gem 'rubocop-performance', '~> 1.20.2', require: false
5
+ gem "base64"
6
+ gem "codeclimate-test-reporter", "~> 1.0.3", group: :test, require: nil
7
+ gem "lhm"
8
+ gem "logger"
9
+ gem "mutex_m", require: false
10
+ gem "rubocop", "~> 1.74.0", require: false
11
+ gem "rubocop-performance", "~> 1.20.2", require: false
12
+ gem "rails", "7.1.3"
9
13
 
10
- gemspec path: '../'
14
+ gemspec path: "../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- departure (6.7.0)
4
+ departure (6.7.1.pre.2)
5
5
  activerecord (>= 6.0.0, < 7.3.0, != 7.0.0)
6
6
  mysql2 (>= 0.4.0, < 0.6.0)
7
7
  railties (>= 6.0.0, < 7.3.0, != 7.0.0)
@@ -196,7 +196,7 @@ GEM
196
196
  zeitwerk (~> 2.6)
197
197
  rainbow (3.1.1)
198
198
  rake (13.2.1)
199
- rdoc (6.7.0)
199
+ rdoc (6.7.1.pre.2)
200
200
  psych (>= 4.0.0)
201
201
  regexp_parser (2.10.0)
202
202
  reline (0.5.9)
@@ -1,10 +1,14 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
- gem 'codeclimate-test-reporter', '~> 1.0.3', group: :test, require: nil
6
- gem 'rails', '7.2.2.1'
7
- gem 'rubocop', '~> 1.74.0', require: false
8
- gem 'rubocop-performance', '~> 1.20.2', require: false
5
+ gem "base64"
6
+ gem "codeclimate-test-reporter", "~> 1.0.3", group: :test, require: nil
7
+ gem "lhm"
8
+ gem "logger"
9
+ gem "mutex_m", require: false
10
+ gem "rubocop", "~> 1.74.0", require: false
11
+ gem "rubocop-performance", "~> 1.20.2", require: false
12
+ gem "rails", "7.2.2.1"
9
13
 
10
- gemspec path: '../'
14
+ gemspec path: "../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- departure (6.7.0)
4
+ departure (6.7.1.pre.2)
5
5
  activerecord (>= 6.0.0, < 7.3.0, != 7.0.0)
6
6
  mysql2 (>= 0.4.0, < 0.6.0)
7
7
  railties (>= 6.0.0, < 7.3.0, != 7.0.0)
@@ -184,7 +184,6 @@ module ActiveRecord
184
184
  with_raw_connection(allow_retry: allow_retry, materialize_transactions: materialize_transactions) do |conn|
185
185
  sync_timezone_changes(conn)
186
186
  result = conn.query(sql)
187
- # conn.abandon_results!
188
187
  verified! if allow_retry
189
188
  handle_warnings(sql)
190
189
  if result.is_a? Process::Status
@@ -42,7 +42,7 @@ module Departure
42
42
  # execution status
43
43
  def run_in_process
44
44
  Open3.popen3(full_command) do |_stdin, stdout, _stderr, waith_thr|
45
- begin
45
+ begin # rubocop:disable Style/RedundantBegin
46
46
  loop do
47
47
  IO.select([stdout])
48
48
  data = stdout.read_nonblock(8192)
@@ -1,6 +1,7 @@
1
1
  module Departure
2
2
  class Configuration
3
- attr_accessor :tmp_path, :global_percona_args, :enabled_by_default, :redirect_stderr
3
+ attr_accessor :tmp_path, :global_percona_args, :enabled_by_default, :redirect_stderr,
4
+ :disable_rails_advisory_lock_patch
4
5
 
5
6
  def initialize
6
7
  @tmp_path = '.'.freeze
@@ -31,6 +31,12 @@ module Departure
31
31
  ActiveRecord::Migration.class_eval do
32
32
  include Departure::Migration
33
33
  end
34
+
35
+ if ActiveRecord::VERSION::MAJOR == 7 && ActiveRecord::VERSION::MINOR == 1
36
+ require 'departure/rails_patches/active_record_migrator_with_advisory_lock_patch'
37
+
38
+ ActiveRecord::Migrator.prepend Departure::RailsPatches::ActiveRecordMigratorWithAdvisoryLockPatch
39
+ end
34
40
  end
35
41
  end
36
42
 
@@ -72,11 +78,14 @@ module Departure
72
78
  class << self
73
79
  def register_integrations
74
80
  require 'active_record/connection_adapters/rails_7_2_departure_adapter'
81
+ require 'departure/rails_patches/active_record_migrator_with_advisory_lock_patch'
75
82
 
76
83
  ActiveSupport.on_load(:active_record) do
77
84
  ActiveRecord::Migration.class_eval do
78
85
  include Departure::Migration
79
86
  end
87
+
88
+ ActiveRecord::Migrator.prepend Departure::RailsPatches::ActiveRecordMigratorWithAdvisoryLockPatch
80
89
  end
81
90
 
82
91
  ActiveRecord::ConnectionAdapters.register 'percona',
@@ -0,0 +1,25 @@
1
+ module Departure
2
+ module RailsPatches
3
+ module ActiveRecordMigratorWithAdvisoryLockPatch
4
+ RELEASE_LOCK_FAILED_MESSAGE = 'Failed to release advisory lock from ActiveRecordMigratorWithAdvisoryLockPatch'
5
+ .freeze
6
+
7
+ def with_advisory_lock
8
+ return super if Departure.configuration.disable_rails_advisory_lock_patch
9
+
10
+ lock_id = generate_migrator_advisory_lock_id
11
+ @__original_connection = connection
12
+
13
+ got_lock = @__original_connection.get_advisory_lock(lock_id)
14
+ raise ConcurrentMigrationError unless got_lock
15
+
16
+ load_migrated # reload schema_migrations to be sure it wasn't changed by another process before we got the lock
17
+ yield
18
+ ensure
19
+ if got_lock && !@__original_connection.release_advisory_lock(lock_id)
20
+ raise ConcurrentMigrationError, RELEASE_LOCK_FAILED_MESSAGE
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  module Departure
2
- VERSION = '6.7.1.pre.1'.freeze
2
+ VERSION = '6.7.1.pre.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: departure-next
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.7.1.pre.1
4
+ version: 6.7.1.pre.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Zayats
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2025-03-19 00:00:00.000000000 Z
18
+ date: 2025-03-28 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: railties
@@ -246,6 +246,7 @@ files:
246
246
  - lib/departure/null_logger.rb
247
247
  - lib/departure/option.rb
248
248
  - lib/departure/rails_adapter.rb
249
+ - lib/departure/rails_patches/active_record_migrator_with_advisory_lock_patch.rb
249
250
  - lib/departure/railtie.rb
250
251
  - lib/departure/runner.rb
251
252
  - lib/departure/user_options.rb
@@ -255,7 +256,7 @@ files:
255
256
  - lib/lhm/column_with_sql.rb
256
257
  - lib/lhm/column_with_type.rb
257
258
  - test_database.rb
258
- homepage: https://github.com/departurerb/departure
259
+ homepage: https://github.com/austio/departure
259
260
  licenses:
260
261
  - MIT
261
262
  metadata: {}
@@ -270,11 +271,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
270
271
  version: 2.7.0
271
272
  required_rubygems_version: !ruby/object:Gem::Requirement
272
273
  requirements:
273
- - - ">"
274
+ - - ">="
274
275
  - !ruby/object:Gem::Version
275
- version: 1.3.1
276
+ version: '0'
276
277
  requirements: []
277
- rubygems_version: 3.4.19
278
+ rubygems_version: 3.5.22
278
279
  signing_key:
279
280
  specification_version: 4
280
281
  summary: pt-online-schema-change runner for ActiveRecord migrations