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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31e81d8469855b4283e3a56ef636df6c13866fc68327e1b8795ce22e09682a23
4
- data.tar.gz: 3d5d3d9cb10a01573bb52edacf2941612545443c1af19e275f181578a8e11678
3
+ metadata.gz: 3ce2b662e846d6d42ccb774dc89abd731e3f7d43ca77f94347df8312df0fb543
4
+ data.tar.gz: 25fd0c42c5e37dd35c0a2abbcaff994b6e1d54eefaa04a6e579a01260885cec3
5
5
  SHA512:
6
- metadata.gz: ac18fbf6c986bd41d3ec0804d203ef54f042304c693017e69b3885129ac344e7401cdac59903fdc9d6deb3cc77273f051a6f175da317be8fac7505b2b1b88b5a
7
- data.tar.gz: 0c6d6cb23559785e115afb4fadf9d9d7af4d1565971aa78dde486a3cfee3538809ad99117e1d2d5d792da681a6cb8db22d0451ce787755e94f90bdceb1ddec7d
6
+ metadata.gz: 53b4b4680d68cf772b3d38430f93ce340226740747ea8825a87a1fe9953b24c26135ed2cbfb3ae840d608992a7bb4cf169ff07d6fc980744fb683153912ef2ca
7
+ data.tar.gz: 9a1558d7ab3c79973314f1f7c74498d77ba901e3d608415028bdee79c618b77ad25e5f39f0f62a4ce249e2ef53b007461eeaa54a506da3cbf625999fe6d02903
@@ -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.2.15
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
- [![Actions Status](https://github.com/bkroeker/temporal_tables/workflows/Continuous%20Integration/badge.svg?branch=master)](https://github.com/bkroeker/temporal_tables/actions)
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
- super.at(@owner.at_value || @owner.eff_to)
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
@@ -2,4 +2,5 @@
2
2
 
3
3
  module TemporalTables
4
4
  END_OF_TIME = '9999-12-31'
5
+ ONE_MICROSECOND = 0.000001.seconds
5
6
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TemporalTables
4
- VERSION = '3.0.0-rc.1'
4
+ VERSION = '3.0.0'
5
5
  end
@@ -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
@@ -2,6 +2,6 @@
2
2
 
3
3
  class Person < ActiveRecord::Base
4
4
  belongs_to :coven
5
- has_many :warts
5
+ has_many :warts, dependent: :destroy
6
6
  has_many :flying_machines
7
7
  end
@@ -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.0', '< 7.2'
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.pre.rc.1
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-08 00:00:00.000000000 Z
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.0'
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.0'
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: 1.3.1
255
+ version: '0'
256
256
  requirements: []
257
257
  rubygems_version: 3.4.10
258
258
  signing_key: