activerecord-bitemporal 2.1.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/.circleci/config.yml +30 -99
- data/CHANGELOG.md +32 -0
- data/Gemfile.lock +12 -14
- data/lib/activerecord-bitemporal/bitemporal.rb +12 -1
- data/lib/activerecord-bitemporal/version.rb +1 -1
- data/lib/activerecord-bitemporal.rb +5 -0
- metadata +2 -2
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/.circleci/config.yml
CHANGED
@@ -1,26 +1,15 @@
|
|
1
1
|
version: 2.1
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
docker:
|
6
|
-
- image: ruby:2.7.5
|
7
|
-
- image: circleci/postgres:11-alpine
|
8
|
-
|
9
|
-
ruby_3_0:
|
10
|
-
docker:
|
11
|
-
- image: ruby:3.0.3
|
12
|
-
- image: circleci/postgres:11-alpine
|
13
|
-
|
14
|
-
ruby_3_1:
|
15
|
-
docker:
|
16
|
-
- image: ruby:3.1.0
|
17
|
-
- image: circleci/postgres:11-alpine
|
18
|
-
|
19
|
-
commands:
|
20
|
-
run_rspec:
|
3
|
+
jobs:
|
4
|
+
rspec:
|
21
5
|
parameters:
|
6
|
+
ruby-version:
|
7
|
+
type: string
|
22
8
|
gemfile:
|
23
9
|
type: string
|
10
|
+
docker:
|
11
|
+
- image: ruby:<< parameters.ruby-version >>
|
12
|
+
- image: cimg/postgres:11.16
|
24
13
|
steps:
|
25
14
|
- checkout
|
26
15
|
- run: gem install bundler
|
@@ -28,86 +17,28 @@ commands:
|
|
28
17
|
- run: bundle exec appraisal << parameters.gemfile >> bundle install
|
29
18
|
- run: bundle exec appraisal << parameters.gemfile >> rspec
|
30
19
|
|
31
|
-
jobs:
|
32
|
-
ruby_2_7_rails_5_2:
|
33
|
-
executor: ruby_2_7
|
34
|
-
steps:
|
35
|
-
- run_rspec:
|
36
|
-
gemfile: rails-5.2
|
37
|
-
|
38
|
-
ruby_2_7_rails_6_0:
|
39
|
-
executor: ruby_2_7
|
40
|
-
steps:
|
41
|
-
- run_rspec:
|
42
|
-
gemfile: rails-6.0
|
43
|
-
|
44
|
-
ruby_2_7_rails_6_1:
|
45
|
-
executor: ruby_2_7
|
46
|
-
steps:
|
47
|
-
- run_rspec:
|
48
|
-
gemfile: rails-6.1
|
49
|
-
|
50
|
-
ruby_2_7_rails_7_0:
|
51
|
-
executor: ruby_2_7
|
52
|
-
steps:
|
53
|
-
- run_rspec:
|
54
|
-
gemfile: rails-7.0
|
55
|
-
|
56
|
-
ruby_2_7_rails_main:
|
57
|
-
executor: ruby_2_7
|
58
|
-
steps:
|
59
|
-
- run_rspec:
|
60
|
-
gemfile: rails-main
|
61
|
-
|
62
|
-
ruby_3_0_rails_6_1:
|
63
|
-
executor: ruby_3_0
|
64
|
-
steps:
|
65
|
-
- run_rspec:
|
66
|
-
gemfile: rails-6.1
|
67
|
-
|
68
|
-
ruby_3_0_rails_7_0:
|
69
|
-
executor: ruby_3_0
|
70
|
-
steps:
|
71
|
-
- run_rspec:
|
72
|
-
gemfile: rails-7.0
|
73
|
-
|
74
|
-
ruby_3_0_rails_main:
|
75
|
-
executor: ruby_3_0
|
76
|
-
steps:
|
77
|
-
- run_rspec:
|
78
|
-
gemfile: rails-main
|
79
|
-
|
80
|
-
ruby_3_1_rails_6_1:
|
81
|
-
executor: ruby_3_1
|
82
|
-
steps:
|
83
|
-
- run_rspec:
|
84
|
-
gemfile: rails-6.1
|
85
|
-
|
86
|
-
ruby_3_1_rails_7_0:
|
87
|
-
executor: ruby_3_1
|
88
|
-
steps:
|
89
|
-
- run_rspec:
|
90
|
-
gemfile: rails-7.0
|
91
|
-
|
92
|
-
ruby_3_1_rails_main:
|
93
|
-
executor: ruby_3_1
|
94
|
-
steps:
|
95
|
-
- run_rspec:
|
96
|
-
gemfile: rails-main
|
97
|
-
|
98
20
|
workflows:
|
99
|
-
version: 2
|
100
|
-
|
101
21
|
test:
|
102
|
-
jobs:
|
103
|
-
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
22
|
+
jobs:
|
23
|
+
- rspec:
|
24
|
+
matrix:
|
25
|
+
parameters:
|
26
|
+
ruby-version:
|
27
|
+
- '2.7'
|
28
|
+
- '3.0'
|
29
|
+
- '3.1'
|
30
|
+
gemfile:
|
31
|
+
- rails-5.2
|
32
|
+
- rails-6.0
|
33
|
+
- rails-6.1
|
34
|
+
- rails-7.0
|
35
|
+
- rails-main
|
36
|
+
exclude:
|
37
|
+
- ruby-version: '3.0'
|
38
|
+
gemfile: rails-5.2
|
39
|
+
- ruby-version: '3.0'
|
40
|
+
gemfile: rails-6.0
|
41
|
+
- ruby-version: '3.1'
|
42
|
+
gemfile: rails-5.2
|
43
|
+
- ruby-version: '3.1'
|
44
|
+
gemfile: rails-6.0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,37 @@
|
|
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
|
+
|
18
|
+
## 2.2.0
|
19
|
+
|
20
|
+
### Breaking Changed
|
21
|
+
|
22
|
+
### Added
|
23
|
+
- [replace postgres docker image](https://github.com/kufu/activerecord-bitemporal/pull/103)
|
24
|
+
- [use Matrix Jobs in CircleCI](https://github.com/kufu/activerecord-bitemporal/pull/107)
|
25
|
+
- [Add support changing swapped_id, when called #destroy](https://github.com/kufu/activerecord-bitemporal/pull/110)
|
26
|
+
|
27
|
+
### Changed
|
28
|
+
|
29
|
+
### Deprecated
|
30
|
+
|
31
|
+
### Removed
|
32
|
+
|
33
|
+
### Fixed
|
34
|
+
|
3
35
|
## 2.1.0
|
4
36
|
|
5
37
|
### 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,6 +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)
|
352
|
+
if @destroyed
|
353
|
+
@_swapped_id_previously_was = swapped_id
|
354
|
+
@_swapped_id = duplicated_instance.swapped_id
|
355
|
+
end
|
348
356
|
}
|
349
357
|
raise ActiveRecord::RecordInvalid unless @destroyed
|
350
358
|
|
@@ -379,6 +387,7 @@ module ActiveRecord
|
|
379
387
|
@new_record = false
|
380
388
|
@previously_new_record = false
|
381
389
|
# NOTE: Hook to copying swapped_id
|
390
|
+
@_swapped_id_previously_was = nil
|
382
391
|
@_swapped_id = fresh_object.swapped_id
|
383
392
|
self
|
384
393
|
end
|
@@ -401,6 +410,7 @@ module ActiveRecord
|
|
401
410
|
@new_record = false
|
402
411
|
@previously_new_record = false
|
403
412
|
# NOTE: Hook to copying swapped_id
|
413
|
+
@_swapped_id_previously_was = nil
|
404
414
|
@_swapped_id = fresh_object.swapped_id
|
405
415
|
self
|
406
416
|
end
|
@@ -422,6 +432,7 @@ module ActiveRecord
|
|
422
432
|
@attributes = fresh_object.instance_variable_get("@attributes")
|
423
433
|
@new_record = false
|
424
434
|
# NOTE: Hook to copying swapped_id
|
435
|
+
@_swapped_id_previously_was = nil
|
425
436
|
@_swapped_id = fresh_object.swapped_id
|
426
437
|
self
|
427
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
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|