online_migrations 0.5.3 → 0.5.4

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: 0ac8a2eb2657fcc3536a9b56d16298f90f8e1a5e626ba52a6e9703b5bcaa7df0
4
- data.tar.gz: c5357f94854fb43d1b8404ed9dcfafc2178430aeb9c6d69555f50629a94da3bd
3
+ metadata.gz: 974e87c3442a03f1a954a338678589549ed5c91fd293a7b4b5a8bad5ba807f32
4
+ data.tar.gz: 1b1dacee542413f623d74e947f704f57fa93a032f5b26c06d3ffc3dec105cc99
5
5
  SHA512:
6
- metadata.gz: 4ccbc274c76ab01f8ece559b3fee27c1c5c0c495225b393c3a4afb7941f0b61d3aab9ef2885195be78ed00f29bd5e6b18e3fe0cb044b745cd791aacf34283492
7
- data.tar.gz: 04fb250e30e7620ac1bd06fddf24a5fdfe616f285422e47e19423e23be0c8117e57d45e45029a2e1212cc5e6ad9baf3605fac8b038152fdc73b2d9a818ba211c
6
+ metadata.gz: 2b4f245c656915711ffb2cb9c1a79f0a4a5a52374c38f01b0cd97a6a0bc06e803b5772ecb4cad36aef6f2dc5b97f543f66c35bcb1b195792c301746fc80c888c
7
+ data.tar.gz: 908f3c213a86b4e7fd48e9120c603c80f68facaa210827fd6ff60637a2b2e62241171f17706fe60cfecc324b318b227575d777a3d988299277f137ecdde0b48f
@@ -120,7 +120,7 @@ enqueue_background_migration("MyMigrationWithArgs", arg1, arg2, ...)
120
120
  * `CopyColumn` - copies data from one column(s) to other(s) (enqueue using `copy_column_in_background`)
121
121
  * `DeleteAssociatedRecords` - deletes records associated with a parent object (enqueue using `delete_associated_records_in_background`)
122
122
  * `DeleteOrphanedRecords` - deletes records with one or more missing relations (enqueue using `delete_orphaned_records_in_background`)
123
- * `PerformActionOnRelation` - performs specific action on a relation or indvidual records (enqueue using `perform_action_on_relation_in_background`)
123
+ * `PerformActionOnRelation` - performs specific action on a relation or individual records (enqueue using `perform_action_on_relation_in_background`)
124
124
  * `ResetCounters` - resets one or more counter caches to their correct value (enqueue using `reset_counters_in_background`)
125
125
 
126
126
  ## Testing
@@ -240,7 +240,7 @@ Specify the throttle condition as a block:
240
240
  ```ruby
241
241
  # config/initializers/online_migrations.rb
242
242
 
243
- OnlineMigrations.config.backround_migrations.throttler = -> { DatabaseStatus.unhealthy? }
243
+ OnlineMigrations.config.background_migrations.throttler = -> { DatabaseStatus.unhealthy? }
244
244
  ```
245
245
 
246
246
  Note that it's up to you to define a throttling condition that makes sense for your app. For example, you can check various PostgreSQL metrics such as replication lag, DB threads, whether DB writes are available, etc.
@@ -254,7 +254,7 @@ If you want to integrate with an exception monitoring service (e.g. Bugsnag), yo
254
254
  ```ruby
255
255
  # config/initializers/online_migrations.rb
256
256
 
257
- OnlineMigrations.config.backround_migrations.error_handler = ->(error, errored_job) do
257
+ OnlineMigrations.config.background_migrations.error_handler = ->(error, errored_job) do
258
258
  Bugsnag.notify(error) do |notification|
259
259
  notification.add_metadata(:background_migration, { name: errored_job.migration_name })
260
260
  end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## master (unreleased)
2
2
 
3
+ ## 0.5.4 (2022-01-03)
4
+
5
+ - Support ruby 3.2.0
6
+
3
7
  ## 0.5.3 (2022-11-10)
4
8
 
5
9
  - Fix removing index by name
data/README.md CHANGED
@@ -69,7 +69,7 @@ class AddAdminToUsers < ActiveRecord::Migration[7.0]
69
69
  # Do not wrap the migration in a transaction so that locks are held for a shorter time.
70
70
  disable_ddl_transaction!
71
71
 
72
- def change
72
+ def up
73
73
  # Lower PostgreSQL's lock timeout to avoid statement queueing.
74
74
  execute "SET lock_timeout TO '5s'" # The lock_timeout duration is customizable.
75
75
 
@@ -88,6 +88,10 @@ class AddAdminToUsers < ActiveRecord::Migration[7.0]
88
88
  execute "SET statement_timeout TO '5s'"
89
89
  change_column_null :users, :admin, false
90
90
  end
91
+
92
+ def down
93
+ remove_column :users, :admin
94
+ end
91
95
  end
92
96
  ```
93
97
 
@@ -38,7 +38,7 @@ OnlineMigrations.configure do |config|
38
38
  # migration failure in production. This is also useful in development to get
39
39
  # a better grasp of what is going on for high-level statements like add_column_with_default.
40
40
  #
41
- # Note: It can be overriden by `ONLINE_MIGRATIONS_VERBOSE_SQL_LOGS` environment variable.
41
+ # Note: It can be overridden by `ONLINE_MIGRATIONS_VERBOSE_SQL_LOGS` environment variable.
42
42
  config.verbose_sql_logs = defined?(Rails) && Rails.env.production?
43
43
 
44
44
  # Lock retries.
@@ -67,25 +67,25 @@ OnlineMigrations.configure do |config|
67
67
 
68
68
  # ==> Background migrations configuration
69
69
  # The number of rows to process in a single background migration run.
70
- # config.backround_migrations.batch_size = 20_000
70
+ # config.background_migrations.batch_size = 20_000
71
71
 
72
72
  # The smaller batches size that the batches will be divided into.
73
- # config.backround_migrations.sub_batch_size = 1000
73
+ # config.background_migrations.sub_batch_size = 1000
74
74
 
75
75
  # The pause interval between each background migration job's execution (in seconds).
76
- # config.backround_migrations.batch_pause = 0.seconds
76
+ # config.background_migrations.batch_pause = 0.seconds
77
77
 
78
78
  # The number of milliseconds to sleep between each sub_batch execution.
79
- # config.backround_migrations.sub_batch_pause_ms = 100
79
+ # config.background_migrations.sub_batch_pause_ms = 100
80
80
 
81
81
  # Maximum number of batch run attempts.
82
82
  # When attempts are exhausted, the individual batch is marked as failed.
83
- # config.backround_migrations.batch_max_attempts = 5
83
+ # config.background_migrations.batch_max_attempts = 5
84
84
 
85
85
  # Configure custom throttler for background migrations.
86
86
  # It will be called before each batch run.
87
87
  # If throttled, the current run will be retried next time.
88
- # config.backround_migrations.throttler = -> { DatabaseStatus.unhealthy? }
88
+ # config.background_migrations.throttler = -> { DatabaseStatus.unhealthy? }
89
89
 
90
90
  # The number of seconds that must pass before the running job is considered stuck.
91
91
  # config.background_migrations.stuck_jobs_timeout = 1.hour
@@ -95,7 +95,7 @@ OnlineMigrations.configure do |config|
95
95
  config.background_migrations.backtrace_cleaner = Rails.backtrace_cleaner
96
96
 
97
97
  # The callback to perform when an error occurs in the migration job.
98
- # config.backround_migrations.error_handler = ->(error, errored_job) do
98
+ # config.background_migrations.error_handler = ->(error, errored_job) do
99
99
  # Bugsnag.notify(error) do |notification|
100
100
  # notification.add_metadata(:background_migration, { name: errored_job.migration_name })
101
101
  # end
@@ -43,7 +43,7 @@ module OnlineMigrations
43
43
  # @return [Proc]
44
44
  #
45
45
  # @example
46
- # OnlineMigrations.config.backround_migrations.throttler = -> { DatabaseStatus.unhealthy? }
46
+ # OnlineMigrations.config.background_migrations.throttler = -> { DatabaseStatus.unhealthy? }
47
47
  #
48
48
  attr_reader :throttler
49
49
 
@@ -64,7 +64,7 @@ module OnlineMigrations
64
64
  # The callback to perform when an error occurs in the migration job.
65
65
  #
66
66
  # @example
67
- # OnlineMigrations.config.backround_migrations.error_handler = ->(error, errored_job) do
67
+ # OnlineMigrations.config.background_migrations.error_handler = ->(error, errored_job) do
68
68
  # Bugsnag.notify(error) do |notification|
69
69
  # notification.add_metadata(:background_migration, { name: errored_job.migration_name })
70
70
  # end
@@ -42,6 +42,7 @@ module OnlineMigrations
42
42
 
43
43
  true
44
44
  end
45
+ ruby2_keywords(:check) if respond_to?(:ruby2_keywords, true)
45
46
 
46
47
  private
47
48
  def check_database_version
@@ -271,7 +272,7 @@ module OnlineMigrations
271
272
  !options[:limit] || (existing_column.limit && options[:limit] >= existing_column.limit)
272
273
  end
273
274
  when :numeric, :decimal
274
- # numeric and decimal are equivalent and can be used interchangably
275
+ # numeric and decimal are equivalent and can be used interchangeably
275
276
  [:numeric, :decimal].include?(existing_type) &&
276
277
  (
277
278
  (
@@ -153,7 +153,7 @@ module OnlineMigrations
153
153
  # This feature is enabled by default in a production Rails environment.
154
154
  # @return [Boolean]
155
155
  #
156
- # @note: It can be overriden by `ONLINE_MIGRATIONS_VERBOSE_SQL_LOGS` environment variable.
156
+ # @note: It can be overridden by `ONLINE_MIGRATIONS_VERBOSE_SQL_LOGS` environment variable.
157
157
  #
158
158
  attr_accessor :verbose_sql_logs
159
159
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OnlineMigrations
4
- VERSION = "0.5.3"
4
+ VERSION = "0.5.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: online_migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - fatkodima
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-10 00:00:00.000000000 Z
11
+ date: 2023-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord