activerecord-bitemporal 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/Gemfile.lock +12 -14
- data/lib/activerecord-bitemporal/bitemporal.rb +12 -2
- data/lib/activerecord-bitemporal/version.rb +1 -1
- data/lib/activerecord-bitemporal.rb +5 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c03b187851d427db0ff32c1d8cc721eaf71da732877d096d0e9cc843b54550a
|
4
|
+
data.tar.gz: 126840e0fc964919ff80a3d403e820958cf81096dca79ff7abd4f40fa603ea27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aac42b7ea34a98bd646c2a2d516f91cd1fc7ca4b86db45fe78e28699ea6dfe0159e7169ed44402be46d7fdcfbe0ff6e2795e69d08df0a5910fc4ceedda0455d8
|
7
|
+
data.tar.gz: b9a7a842b205529e3bdc89352e9cd505435a009c179bdf54353942747d0b3275d48985628e2347dc31887d85da351a7af0d2d18fd7ac4e89fdcc1074aef73078
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 2.3.0
|
4
|
+
|
5
|
+
### Breaking Changed
|
6
|
+
|
7
|
+
### Added
|
8
|
+
- [Add `InstanceMethods#swapped_id_previously_was`](https://github.com/kufu/activerecord-bitemporal/pull/114)
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
|
12
|
+
### Deprecated
|
13
|
+
|
14
|
+
### Removed
|
15
|
+
|
16
|
+
### Fixed
|
17
|
+
|
3
18
|
## 2.2.0
|
4
19
|
|
5
20
|
### Breaking Changed
|
data/Gemfile.lock
CHANGED
@@ -1,36 +1,35 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
activerecord-bitemporal (
|
4
|
+
activerecord-bitemporal (2.3.0)
|
5
5
|
activerecord (>= 5.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (
|
11
|
-
activesupport (=
|
12
|
-
activerecord (
|
13
|
-
activemodel (=
|
14
|
-
activesupport (=
|
15
|
-
activesupport (
|
10
|
+
activemodel (7.0.4.2)
|
11
|
+
activesupport (= 7.0.4.2)
|
12
|
+
activerecord (7.0.4.2)
|
13
|
+
activemodel (= 7.0.4.2)
|
14
|
+
activesupport (= 7.0.4.2)
|
15
|
+
activesupport (7.0.4.2)
|
16
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
17
|
i18n (>= 1.6, < 2)
|
18
18
|
minitest (>= 5.1)
|
19
19
|
tzinfo (~> 2.0)
|
20
|
-
zeitwerk (~> 2.3)
|
21
20
|
appraisal (2.2.0)
|
22
21
|
bundler
|
23
22
|
rake
|
24
23
|
thor (>= 0.14.0)
|
25
24
|
byebug (10.0.2)
|
26
25
|
coderay (1.1.2)
|
27
|
-
concurrent-ruby (1.
|
26
|
+
concurrent-ruby (1.2.0)
|
28
27
|
database_cleaner (1.7.0)
|
29
28
|
diff-lcs (1.3)
|
30
|
-
i18n (1.
|
29
|
+
i18n (1.12.0)
|
31
30
|
concurrent-ruby (~> 1.0)
|
32
31
|
method_source (0.9.0)
|
33
|
-
minitest (5.
|
32
|
+
minitest (5.17.0)
|
34
33
|
pg (1.1.3)
|
35
34
|
pry (0.11.3)
|
36
35
|
coderay (~> 1.1.0)
|
@@ -54,9 +53,8 @@ GEM
|
|
54
53
|
rspec-support (3.8.0)
|
55
54
|
thor (0.20.3)
|
56
55
|
timecop (0.9.1)
|
57
|
-
tzinfo (2.0.
|
56
|
+
tzinfo (2.0.5)
|
58
57
|
concurrent-ruby (~> 1.0)
|
59
|
-
zeitwerk (2.4.2)
|
60
58
|
|
61
59
|
PLATFORMS
|
62
60
|
ruby
|
@@ -74,4 +72,4 @@ DEPENDENCIES
|
|
74
72
|
timecop
|
75
73
|
|
76
74
|
BUNDLED WITH
|
77
|
-
2.2.
|
75
|
+
2.2.33
|
@@ -280,7 +280,10 @@ module ActiveRecord
|
|
280
280
|
# MEMO: Do not copy `swapped_id`
|
281
281
|
def dup(*)
|
282
282
|
super.tap { |itself|
|
283
|
-
itself.instance_exec
|
283
|
+
itself.instance_exec do
|
284
|
+
@_swapped_id_previously_was = nil
|
285
|
+
@_swapped_id = nil
|
286
|
+
end unless itself.frozen?
|
284
287
|
}
|
285
288
|
end
|
286
289
|
end
|
@@ -319,6 +322,7 @@ module ActiveRecord
|
|
319
322
|
after_instance.save!(validate: false)
|
320
323
|
|
321
324
|
# update 後に新しく生成したインスタンスのデータを移行する
|
325
|
+
@_swapped_id_previously_was = swapped_id
|
322
326
|
@_swapped_id = after_instance.swapped_id
|
323
327
|
self.valid_from = after_instance.valid_from
|
324
328
|
self.valid_to = after_instance.valid_to
|
@@ -345,7 +349,10 @@ module ActiveRecord
|
|
345
349
|
duplicated_instance.valid_to = target_datetime
|
346
350
|
duplicated_instance.transaction_from = current_time
|
347
351
|
duplicated_instance.save!(validate: false)
|
348
|
-
|
352
|
+
if @destroyed
|
353
|
+
@_swapped_id_previously_was = swapped_id
|
354
|
+
@_swapped_id = duplicated_instance.swapped_id
|
355
|
+
end
|
349
356
|
}
|
350
357
|
raise ActiveRecord::RecordInvalid unless @destroyed
|
351
358
|
|
@@ -380,6 +387,7 @@ module ActiveRecord
|
|
380
387
|
@new_record = false
|
381
388
|
@previously_new_record = false
|
382
389
|
# NOTE: Hook to copying swapped_id
|
390
|
+
@_swapped_id_previously_was = nil
|
383
391
|
@_swapped_id = fresh_object.swapped_id
|
384
392
|
self
|
385
393
|
end
|
@@ -402,6 +410,7 @@ module ActiveRecord
|
|
402
410
|
@new_record = false
|
403
411
|
@previously_new_record = false
|
404
412
|
# NOTE: Hook to copying swapped_id
|
413
|
+
@_swapped_id_previously_was = nil
|
405
414
|
@_swapped_id = fresh_object.swapped_id
|
406
415
|
self
|
407
416
|
end
|
@@ -423,6 +432,7 @@ module ActiveRecord
|
|
423
432
|
@attributes = fresh_object.instance_variable_get("@attributes")
|
424
433
|
@new_record = false
|
425
434
|
# NOTE: Hook to copying swapped_id
|
435
|
+
@_swapped_id_previously_was = nil
|
426
436
|
@_swapped_id = fresh_object.swapped_id
|
427
437
|
self
|
428
438
|
end
|
@@ -76,6 +76,7 @@ module ActiveRecord::Bitemporal::Bitemporalize
|
|
76
76
|
include ActiveRecord::Bitemporal::Persistence
|
77
77
|
|
78
78
|
def swap_id!(without_clear_changes_information: false)
|
79
|
+
@_swapped_id_previously_was = nil
|
79
80
|
@_swapped_id = self.id
|
80
81
|
self.id = self.send(bitemporal_id_key)
|
81
82
|
clear_attribute_changes([:id]) unless without_clear_changes_information
|
@@ -85,6 +86,10 @@ module ActiveRecord::Bitemporal::Bitemporalize
|
|
85
86
|
@_swapped_id || self.id
|
86
87
|
end
|
87
88
|
|
89
|
+
def swapped_id_previously_was
|
90
|
+
@_swapped_id_previously_was
|
91
|
+
end
|
92
|
+
|
88
93
|
def bitemporal_id_key
|
89
94
|
self.class.bitemporal_id_key
|
90
95
|
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: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SmartHR
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -174,7 +174,7 @@ homepage: https://github.com/kufu/activerecord-bitemporal
|
|
174
174
|
licenses:
|
175
175
|
- Apache 2.0
|
176
176
|
metadata: {}
|
177
|
-
post_install_message:
|
177
|
+
post_install_message:
|
178
178
|
rdoc_options: []
|
179
179
|
require_paths:
|
180
180
|
- lib
|
@@ -189,8 +189,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
189
|
- !ruby/object:Gem::Version
|
190
190
|
version: '0'
|
191
191
|
requirements: []
|
192
|
-
rubygems_version: 3.
|
193
|
-
signing_key:
|
192
|
+
rubygems_version: 3.1.6
|
193
|
+
signing_key:
|
194
194
|
specification_version: 4
|
195
195
|
summary: BiTemporal Data Model for ActiveRecord
|
196
196
|
test_files: []
|