online_migrations 0.8.0 → 0.8.1

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: 46406fc60e15af6b4dfec0d548c6ca04f9dc3572eb544046e45f2dbd58cbf2eb
4
- data.tar.gz: f969563b52c1dac70ede26c9a5bd2094295e93d5fc61e85056adec6b3b22fa69
3
+ metadata.gz: 9bfe87b009fa9199b4deb0a1bf7e63dac043fa8f29c25f4f93c55fd136155f2d
4
+ data.tar.gz: 0a95c4b4de358769bce7d3855f7df67c08d027279b523d0ea550a383b60cd6a8
5
5
  SHA512:
6
- metadata.gz: a7e728653580b3a1635b895c4b6efba8425f300a5a239ad8dd0f07cce06503e1f1a994597535c05b4946444c97f6f210c51ece0796799ac7fa8744ff93c1d48c
7
- data.tar.gz: 917fc0a780b7bba7050b65c9cdcd1b5544afb87133078cdf833863b892459bc69ae657a365dd72bd5fd856a0a63a3862a4e19e3f9cd282c252a4a60b9415c19b
6
+ metadata.gz: 95b0d869484b407b295426bf1b836f00ce71c297fc1ef35fe817e449f126ccbc7e7df512efc30c16cda9dfb9755c86e1b409f9787f40708341aba422128b0d60
7
+ data.tar.gz: 42b829796b7fd0503416460775ac1c7596fce43621667a9144cd06b9000e35f8054398cadbf82f370b3e8ca988bcd7ce53b505982e8e5b3ed7e6991c71f373aa
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## master (unreleased)
2
2
 
3
+ ## 0.8.1 (2023-08-04)
4
+
5
+ - Fix `update_columns_in_batches` when multiple columns are passed
6
+ - Fix reverting adding/removing not null and text limit constraints
7
+
3
8
  ## 0.8.0 (2023-07-24)
4
9
 
5
10
  - Add check for `change_column_default`
@@ -47,6 +47,7 @@ module OnlineMigrations
47
47
  record(:"#{method}", args, &block) # record(:create_table, args, &block)
48
48
  end # end
49
49
  RUBY
50
+ ruby2_keywords(method) if respond_to?(:ruby2_keywords, true)
50
51
  end
51
52
 
52
53
  private
@@ -130,28 +131,21 @@ module OnlineMigrations
130
131
  end
131
132
 
132
133
  def invert_add_not_null_constraint(args)
133
- options = args.extract_options!
134
- table_name, column = args
135
- options.delete(:validate)
136
- [:remove_not_null_constraint, [table_name, column, **options]]
134
+ args.last.delete(:validate) if args.last.is_a?(Hash)
135
+ [:remove_not_null_constraint, args]
137
136
  end
138
137
 
139
138
  def invert_add_text_limit_constraint(args)
140
- options = args.extract_options!
141
- table_name, column, _limit = args
142
- options.delete(:validate)
143
- [:remove_text_limit_constraint, [table_name, column, **options]]
139
+ args.last.delete(:validate) if args.last.is_a?(Hash)
140
+ [:remove_text_limit_constraint, args]
144
141
  end
145
142
 
146
143
  def invert_remove_text_limit_constraint(args)
147
- options = args.extract_options!
148
- table_name, column, limit = args
149
-
150
- unless limit
144
+ unless args[2]
151
145
  raise ActiveRecord::IrreversibleMigration, "remove_text_limit_constraint is only reversible if given a limit."
152
146
  end
153
147
 
154
- [:add_text_limit_constraint, [table_name, column, limit, **options]]
148
+ [:add_text_limit_constraint, args]
155
149
  end
156
150
  end
157
151
  end
@@ -89,11 +89,15 @@ module OnlineMigrations
89
89
  # Ignore subqueries in conditions
90
90
  unless value.is_a?(Arel::Nodes::SqlLiteral) && value.to_s =~ /select\s+/i
91
91
  arel_column = model.arel_table[column_name]
92
- arel_column.not_eq(value).or(arel_column.eq(nil))
92
+ if value.nil?
93
+ arel_column.not_eq(nil)
94
+ else
95
+ arel_column.not_eq(value).or(arel_column.eq(nil))
96
+ end
93
97
  end
94
98
  end.compact
95
99
 
96
- batch_relation = model.where(conditions.inject(:and))
100
+ batch_relation = model.where(conditions.inject(:or))
97
101
  batch_relation = yield batch_relation if block_given?
98
102
 
99
103
  iterator = BatchIterator.new(batch_relation)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OnlineMigrations
4
- VERSION = "0.8.0"
4
+ VERSION = "0.8.1"
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.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - fatkodima
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-24 00:00:00.000000000 Z
11
+ date: 2023-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord