online_migrations 0.30.0 → 0.31.0

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: 428fd65e363b915608f720370a2cd91ec14749cd17933ec4e26351bb4745084a
4
- data.tar.gz: ae292bba4cd1b557694f78240a7da761c8d890aa691cc6b485ddd9f71fd339c5
3
+ metadata.gz: '0872638ad98f95ef8fa347b719f14d548fec58402dd8fc6a06702c9d884f9346'
4
+ data.tar.gz: 572c037d2bf35cf048b8e1ee45fb0e464d375a3adec18264ba3e8f78b5cd433b
5
5
  SHA512:
6
- metadata.gz: 59c0573c24d75488c849fa746d6346c31e439d66032725264ce724e97ab8ffbd16cebb03a57ad75071e2b29bf884be0b47696abdcadc72d974effaafd73fe8b4
7
- data.tar.gz: 73de95254d001d4d285a48ad4d3adb60726ab6bf0bb86b085dde8466b6e1e85fbb668738f09121c38718504ad253615afb3da5e24f56bc48bd01ce9d369cdd4c
6
+ metadata.gz: 8da4b37bc6b6e88803a478844b32aa6d04d28b95ab6a147caea69a22e1ce512a70e0df9e6196ceb0cbc87a5c1a164f01d927adcb054d36d2aa98e56ecac854c9
7
+ data.tar.gz: f0a3f79d9ba42b596f27861ed9b046d82fd3805b47d62c7745b4bac7e69033904a6bbd90ea9d137370679e6e4ea8a42672cd31378f28b8a6b5d52141837c4d86
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## master (unreleased)
2
2
 
3
+ ## 0.31.0 (2025-10-22)
4
+
5
+ - Store backtraces for failed background data migrations jobs
6
+ - Make `add_column` idempotent
7
+ - Fix `NullLockRetrier#with_lock_retries` method signature
8
+
3
9
  ## 0.30.0 (2025-10-17)
4
10
 
5
11
  - Fix `remove_check_constraint` when using `:if_exists`
@@ -6,6 +6,8 @@ module OnlineMigrations
6
6
  class MigrationJob
7
7
  include Sidekiq::IterableJob
8
8
 
9
+ sidekiq_options backtrace: true
10
+
9
11
  sidekiq_retry_in do |count, _exception, jobhash|
10
12
  migration_id = jobhash["args"].fetch(0)
11
13
  migration = Migration.find(migration_id)
@@ -251,7 +251,7 @@ module OnlineMigrations
251
251
  def delay(_attempt, _command = nil, _arguments = [])
252
252
  end
253
253
 
254
- def with_lock_retries(_connection)
254
+ def with_lock_retries(_connection, _command = nil, *_arguments)
255
255
  yield
256
256
  end
257
257
  end
@@ -630,6 +630,19 @@ module OnlineMigrations
630
630
  remove_check_constraint(table_name, name: name)
631
631
  end
632
632
 
633
+ # Extends default method to be idempotent and automatically recreate invalid indexes.
634
+ #
635
+ # @see https://api.rubyonrails.org/v8.1/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-add_column
636
+ #
637
+ def add_column(table_name, column_name, type, **options)
638
+ if column_exists?(table_name, column_name, type, **options)
639
+ Utils.say("Column was not added because it already exists (this may be due to an aborted migration " \
640
+ "or similar) table_name: #{table_name}, column_name: #{column_name}")
641
+ else
642
+ super
643
+ end
644
+ end
645
+
633
646
  # Adds a reference to the table with minimal locking
634
647
  #
635
648
  # Active Record adds an index non-`CONCURRENTLY` to references by default, which blocks writes.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OnlineMigrations
4
- VERSION = "0.30.0"
4
+ VERSION = "0.31.0"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: online_migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.0
4
+ version: 0.31.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - fatkodima
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-10-17 00:00:00.000000000 Z
10
+ date: 2025-10-22 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activerecord