activerecord-bitemporal 2.2.0 → 3.0.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 +4 -4
- data/CHANGELOG.md +30 -0
- data/Gemfile.lock +11 -13
- data/lib/activerecord-bitemporal/bitemporal.rb +18 -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: 6034ded2e7c8b1ec28b1632ba21f6245c0e2dc6a96786294bc6883c0cc8bbbcb
|
4
|
+
data.tar.gz: 3b6fca0b70c57242aa69136b5d41e7438603a0b30d1dd658ccbbebff8dd3d73d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6783cd51d729e2beb9ab8a8f67039ca2258bee3ad1258b7cf96f8d2b9a86d33daaa3aa6db18b96fdc277b6ee69a224c85d26d47ac5d54fb581c8685e1c4a1459
|
7
|
+
data.tar.gz: 4b57fe700e248b0e630cc73959f6817b66977bc93e018445ea0c95e363b28bea770ba5869d4261a5031ae9609c78a883adf98aef821ecba942225e31fa32c991
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,35 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 3.0.0
|
4
|
+
|
5
|
+
### Breaking Changed
|
6
|
+
- [Assign updated bitemporal times to the receiver after update/destroy](https://github.com/kufu/activerecord-bitemporal/pull/118)
|
7
|
+
|
8
|
+
### Added
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
|
12
|
+
### Deprecated
|
13
|
+
|
14
|
+
### Removed
|
15
|
+
|
16
|
+
### Fixed
|
17
|
+
|
18
|
+
## 2.3.0
|
19
|
+
|
20
|
+
### Breaking Changed
|
21
|
+
|
22
|
+
### Added
|
23
|
+
- [Add `InstanceMethods#swapped_id_previously_was`](https://github.com/kufu/activerecord-bitemporal/pull/114)
|
24
|
+
|
25
|
+
### Changed
|
26
|
+
|
27
|
+
### Deprecated
|
28
|
+
|
29
|
+
### Removed
|
30
|
+
|
31
|
+
### Fixed
|
32
|
+
|
3
33
|
## 2.2.0
|
4
34
|
|
5
35
|
### Breaking Changed
|
data/Gemfile.lock
CHANGED
@@ -1,36 +1,35 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
activerecord-bitemporal (0.
|
4
|
+
activerecord-bitemporal (3.0.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.6)
|
58
57
|
concurrent-ruby (~> 1.0)
|
59
|
-
zeitwerk (2.4.2)
|
60
58
|
|
61
59
|
PLATFORMS
|
62
60
|
ruby
|
@@ -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,9 +322,12 @@ 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
|
329
|
+
self.transaction_from = after_instance.transaction_from
|
330
|
+
self.transaction_to = after_instance.transaction_to
|
325
331
|
|
326
332
|
1
|
327
333
|
# MEMO: Must return false instead of nil, if `#_update_row` failure.
|
@@ -345,7 +351,14 @@ module ActiveRecord
|
|
345
351
|
duplicated_instance.valid_to = target_datetime
|
346
352
|
duplicated_instance.transaction_from = current_time
|
347
353
|
duplicated_instance.save!(validate: false)
|
348
|
-
|
354
|
+
if @destroyed
|
355
|
+
@_swapped_id_previously_was = swapped_id
|
356
|
+
@_swapped_id = duplicated_instance.swapped_id
|
357
|
+
self.valid_from = duplicated_instance.valid_from
|
358
|
+
self.valid_to = duplicated_instance.valid_to
|
359
|
+
self.transaction_from = duplicated_instance.transaction_from
|
360
|
+
self.transaction_to = duplicated_instance.transaction_to
|
361
|
+
end
|
349
362
|
}
|
350
363
|
raise ActiveRecord::RecordInvalid unless @destroyed
|
351
364
|
|
@@ -380,6 +393,7 @@ module ActiveRecord
|
|
380
393
|
@new_record = false
|
381
394
|
@previously_new_record = false
|
382
395
|
# NOTE: Hook to copying swapped_id
|
396
|
+
@_swapped_id_previously_was = nil
|
383
397
|
@_swapped_id = fresh_object.swapped_id
|
384
398
|
self
|
385
399
|
end
|
@@ -402,6 +416,7 @@ module ActiveRecord
|
|
402
416
|
@new_record = false
|
403
417
|
@previously_new_record = false
|
404
418
|
# NOTE: Hook to copying swapped_id
|
419
|
+
@_swapped_id_previously_was = nil
|
405
420
|
@_swapped_id = fresh_object.swapped_id
|
406
421
|
self
|
407
422
|
end
|
@@ -423,6 +438,7 @@ module ActiveRecord
|
|
423
438
|
@attributes = fresh_object.instance_variable_get("@attributes")
|
424
439
|
@new_record = false
|
425
440
|
# NOTE: Hook to copying swapped_id
|
441
|
+
@_swapped_id_previously_was = nil
|
426
442
|
@_swapped_id = fresh_object.swapped_id
|
427
443
|
self
|
428
444
|
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:
|
4
|
+
version: 3.0.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-02-01 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: []
|