temporal_tables 3.0.0.pre.rc.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +20 -1
- data/README.md +1 -1
- data/lib/temporal_tables/association_extensions.rb +6 -2
- data/lib/temporal_tables/constants.rb +1 -0
- data/lib/temporal_tables/version.rb +1 -1
- data/spec/basic_history_spec.rb +20 -0
- data/spec/internal/app/models/person.rb +1 -1
- data/temporal_tables.gemspec +1 -1
- 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: 3ce2b662e846d6d42ccb774dc89abd731e3f7d43ca77f94347df8312df0fb543
|
4
|
+
data.tar.gz: 25fd0c42c5e37dd35c0a2abbcaff994b6e1d54eefaa04a6e579a01260885cec3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53b4b4680d68cf772b3d38430f93ce340226740747ea8825a87a1fe9953b24c26135ed2cbfb3ae840d608992a7bb4cf169ff07d6fc980744fb683153912ef2ca
|
7
|
+
data.tar.gz: 9a1558d7ab3c79973314f1f7c74498d77ba901e3d608415028bdee79c618b77ad25e5f39f0f62a4ce249e2ef53b007461eeaa54a506da3cbf625999fe6d02903
|
data/.github/workflows/test.yml
CHANGED
@@ -4,6 +4,8 @@ on:
|
|
4
4
|
push:
|
5
5
|
branches:
|
6
6
|
- '**'
|
7
|
+
tags:
|
8
|
+
- "v*.*.*"
|
7
9
|
pull_request:
|
8
10
|
branches:
|
9
11
|
- master
|
@@ -44,7 +46,7 @@ jobs:
|
|
44
46
|
ruby-version: "${{ matrix.ruby }}"
|
45
47
|
- name: Bundle
|
46
48
|
run: |
|
47
|
-
gem install bundler:2.
|
49
|
+
gem install bundler:2.4.10
|
48
50
|
bundle install
|
49
51
|
|
50
52
|
- name: Run Rubocop
|
@@ -55,3 +57,20 @@ jobs:
|
|
55
57
|
PGHOST: localhost
|
56
58
|
PGUSER: postgres
|
57
59
|
run: bundle exec rspec
|
60
|
+
|
61
|
+
publish:
|
62
|
+
needs: [tests]
|
63
|
+
runs-on: ubuntu-latest
|
64
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
65
|
+
|
66
|
+
permissions:
|
67
|
+
contents: write
|
68
|
+
id-token: write
|
69
|
+
|
70
|
+
steps:
|
71
|
+
- uses: actions/checkout@v2
|
72
|
+
- uses: ruby/setup-ruby@v1
|
73
|
+
with:
|
74
|
+
ruby-version: "3.2.2"
|
75
|
+
bundler-cache: true
|
76
|
+
- uses: rubygems/release-gem@v1
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![
|
1
|
+
[![Continuous Integration](https://github.com/bkroeker/temporal_tables/actions/workflows/test.yml/badge.svg)](https://github.com/bkroeker/temporal_tables/actions/workflows/test.yml)
|
2
2
|
|
3
3
|
# TemporalTables
|
4
4
|
|
@@ -10,8 +10,12 @@ module TemporalTables
|
|
10
10
|
# Using responds_to? results in an infinite loop stack overflow.
|
11
11
|
if @owner.public_methods.include?(:at_value)
|
12
12
|
# If this is a history record but no at time was given,
|
13
|
-
# assume the record's effective to date
|
14
|
-
|
13
|
+
# assume the record's effective to date minus 1 microsecond
|
14
|
+
# The logic here is to provide the association's history record at the end of
|
15
|
+
# the parent record's effective period. Since effective ranges are exclusive of
|
16
|
+
# the eff_to value, and the eff_* columns are datetime types with a precision of microseconds,
|
17
|
+
# 1 microsecond before eff_to is the end of the inclusive boundary to accomplish this.
|
18
|
+
super.at(@owner.at_value || (@owner.eff_to - TemporalTables::ONE_MICROSECOND))
|
15
19
|
else
|
16
20
|
super
|
17
21
|
end
|
data/spec/basic_history_spec.rb
CHANGED
@@ -229,6 +229,26 @@ describe Person do
|
|
229
229
|
end
|
230
230
|
end
|
231
231
|
end
|
232
|
+
|
233
|
+
describe 'when removing a creature' do
|
234
|
+
let!(:wart) { Wart.create person: emily, hairiness: 3 }
|
235
|
+
|
236
|
+
before do
|
237
|
+
emily.destroy!
|
238
|
+
sleep 0.1
|
239
|
+
end
|
240
|
+
|
241
|
+
it 'destroys associated warts and we remember the historical association' do
|
242
|
+
expect(emily).to be_destroyed
|
243
|
+
expect { wart.reload }.to raise_error(ActiveRecord::RecordNotFound) # as it belonged to emily
|
244
|
+
|
245
|
+
wart_h = wart.history.last # the last version of the wart
|
246
|
+
expect(wart_h).to be_present
|
247
|
+
|
248
|
+
emily_h = wart_h.person
|
249
|
+
expect(emily_h).to be_present # we should be able to tell what person our wart belonged to
|
250
|
+
end
|
251
|
+
end
|
232
252
|
end
|
233
253
|
|
234
254
|
describe Bird do
|
data/temporal_tables.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |gem|
|
|
24
24
|
gem.required_ruby_version = '>= 3.0.0'
|
25
25
|
gem.metadata = { 'rubygems_mfa_required' => 'true' }
|
26
26
|
|
27
|
-
gem.add_dependency 'rails', '>= 6.
|
27
|
+
gem.add_dependency 'rails', '>= 6.1', '< 7.2'
|
28
28
|
gem.add_development_dependency 'combustion', '~> 1'
|
29
29
|
gem.add_development_dependency 'database_cleaner'
|
30
30
|
gem.add_development_dependency 'gemika', '~> 0.8'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: temporal_tables
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brent Kroeker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '6.
|
19
|
+
version: '6.1'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '7.2'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '6.
|
29
|
+
version: '6.1'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '7.2'
|
@@ -250,9 +250,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
250
250
|
version: 3.0.0
|
251
251
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
252
252
|
requirements:
|
253
|
-
- - "
|
253
|
+
- - ">="
|
254
254
|
- !ruby/object:Gem::Version
|
255
|
-
version:
|
255
|
+
version: '0'
|
256
256
|
requirements: []
|
257
257
|
rubygems_version: 3.4.10
|
258
258
|
signing_key:
|