activerecord-bitemporal 5.0.0 → 5.1.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: 25ef613d84eda786e3d04e90aeb9cc95b68887a84863200aa0622be9e89c73ea
4
- data.tar.gz: 63920865d4f8f27703b6ffeaf4e0c38d297ea4bff22bf01a3884136875b2ccde
3
+ metadata.gz: 682d7ade7951759a2237d6395aab4dccc06d5c5ea6d1820b20e1bd1301d2efc7
4
+ data.tar.gz: a58bb4c8b01a5f7724ad367ab69e45a54f715b96a0d789e7690689798d0f0a88
5
5
  SHA512:
6
- metadata.gz: 6fbe2830897e6c3f70f29431f591e8fa9cd332ae260e23ef3c23b7afff7259819bc54b8bb9de38d26c07a96c1cd3e93af5f5b7b559d2814b61b3cabfb3dcb2a6
7
- data.tar.gz: 3e45d6a45de435475388a77a534521049b603bddc5910046fc5b8f4c2577ad25e75387f397014374d94b4d3c515c4e4456ff76c4673952f06b497446166a7927
6
+ metadata.gz: a1761e5e97fc83beac29d7e23edec2ab5bb4d02958b5a7600073b099ca800a6ad3ffa3f8f9bc423aafb412c4c11a2bb1cb03d09d4fd36b6d77e7dd02560a9493
7
+ data.tar.gz: efc543c3eb6b2ab89d3556eb25f342983d8e5854ebbec77ee6cf853c01dd0ccd64945264c53f30bacb9d370a6083ba65b3791e88b26c0c5c4ecea4481ad66e0c
@@ -6,15 +6,10 @@ addAssignees: false
6
6
 
7
7
  # A list of reviewers to be added to pull requests (GitHub user name)
8
8
  reviewers:
9
- - Dooor
10
- - QWYNG
11
- - bonobono555
12
9
  - krororo
13
10
  - lighty
14
11
  - mkmn
15
- - motsat
16
12
  - osyo-manga
17
- - wakasa51
18
13
  - wata727
19
14
  - yono
20
15
 
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.1.0
4
+
5
+ ### Added
6
+
7
+ ### Changed
8
+
9
+ ### Deprecated
10
+
11
+ ### Removed
12
+
13
+ ### Fixed
14
+
15
+ - [Remove `joinable: false` #156](https://github.com/kufu/activerecord-bitemporal/pull/156)
16
+
17
+ ### Chores
18
+
19
+ - [Remove database_cleaner #162](https://github.com/kufu/activerecord-bitemporal/pull/162)
20
+
21
+ ## 5.0.1
22
+
23
+ - [Fix a typo #157](https://github.com/kufu/activerecord-bitemporal/pull/157)
24
+ - [Remove unneeded unscope values #159](https://github.com/kufu/activerecord-bitemporal/pull/159)
25
+ - [Remove unused `without_ignore` option #160](https://github.com/kufu/activerecord-bitemporal/pull/160)
26
+ - [update auto assign #161](https://github.com/kufu/activerecord-bitemporal/pull/161)
27
+
3
28
  ## 5.0.0
4
29
 
5
30
  ### Breaking Changed
@@ -31,6 +31,5 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency "pg"
32
32
  spec.add_development_dependency "pry"
33
33
  spec.add_development_dependency "pry-byebug"
34
- spec.add_development_dependency "database_cleaner"
35
34
  spec.add_development_dependency "timecop"
36
35
  end
@@ -359,7 +359,7 @@ module ActiveRecord
359
359
  def destroy(force_delete: false, operated_at: nil)
360
360
  return super() if force_delete
361
361
 
362
- ActiveRecord::Base.transaction(requires_new: true, joinable: false) do
362
+ ActiveRecord::Base.transaction(requires_new: true) do
363
363
  @destroyed = false
364
364
  _run_destroy_callbacks {
365
365
  operated_at ||= Time.current
@@ -577,7 +577,7 @@ module ActiveRecord
577
577
  target_datetime
578
578
  # NOTE: 新規作成時以外では target_datetime の値を基準としてバリデーションする
579
579
  # 更新時にバリデーションする場合、valid_from の時間ではなくて target_datetime の時間を基準としているため
580
- # valdi_from を基準としてしまうと整合性が取れなくなってしまう
580
+ # valid_from を基準としてしまうと整合性が取れなくなってしまう
581
581
  elsif !record.new_record?
582
582
  target_datetime
583
583
  else
@@ -259,7 +259,7 @@ module ActiveRecord::Bitemporal
259
259
  :gteq # column >= datetime
260
260
  ].each { |op|
261
261
  module_eval <<-STR, __FILE__, __LINE__ + 1
262
- def _#{column}_#{op}(datetime,**)
262
+ def _#{column}_#{op}(datetime)
263
263
  target_datetime = datetime&.in_time_zone || Time.current
264
264
  bitemporal_rewhere_bind("#{column}", :#{op}, target_datetime)
265
265
  .tap { |relation| break relation.bitemporal_rewhere_bind("#{column}", :#{op}, target_datetime, bitemporal_value[:through].arel_table) if bitemporal_value[:through] }
@@ -355,14 +355,9 @@ module ActiveRecord::Bitemporal
355
355
  relation.bitemporal_value[:with_transaction_datetime] = :default_scope
356
356
  end
357
357
 
358
- # Calling scope was slow, so don't call scope
359
- relation.unscope_values += [
360
- { where: "#{table.name}.transaction_from" },
361
- { where: "#{table.name}.transaction_to" }
362
- ]
363
358
  relation = relation
364
- ._transaction_from_lteq(transaction_datetime || datetime, without_ignore: true)
365
- ._transaction_to_gt(transaction_datetime || datetime, without_ignore: true)
359
+ ._transaction_from_lteq(transaction_datetime || datetime)
360
+ ._transaction_to_gt(transaction_datetime || datetime)
366
361
  else
367
362
  relation.tap { |relation| relation.without_transaction_datetime unless ActiveRecord::Bitemporal.transaction_datetime }
368
363
  end
@@ -375,13 +370,9 @@ module ActiveRecord::Bitemporal
375
370
  relation.bitemporal_value[:with_valid_datetime] = :default_scope
376
371
  end
377
372
 
378
- relation.unscope_values += [
379
- { where: "#{table.name}.valid_from" },
380
- { where: "#{table.name}.valid_to" }
381
- ]
382
373
  relation = relation
383
- ._valid_from_lteq(valid_datetime || datetime, without_ignore: true)
384
- ._valid_to_gt(valid_datetime || datetime, without_ignore: true)
374
+ ._valid_from_lteq(valid_datetime || datetime)
375
+ ._valid_to_gt(valid_datetime || datetime)
385
376
  else
386
377
  relation.tap { |relation| relation.without_valid_datetime unless ActiveRecord::Bitemporal.valid_datetime }
387
378
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module Bitemporal
5
- VERSION = "5.0.0"
5
+ VERSION = "5.1.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-bitemporal
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SmartHR
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-02 00:00:00.000000000 Z
11
+ date: 2024-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -108,20 +108,6 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: database_cleaner
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: timecop
127
113
  requirement: !ruby/object:Gem::Requirement
@@ -190,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
176
  - !ruby/object:Gem::Version
191
177
  version: '0'
192
178
  requirements: []
193
- rubygems_version: 3.3.26
179
+ rubygems_version: 3.3.27
194
180
  signing_key:
195
181
  specification_version: 4
196
182
  summary: BiTemporal Data Model for ActiveRecord