sequel_bitemporal 0.7.4 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -2
- data/lib/sequel/plugins/bitemporal.rb +12 -1
- data/sequel_bitemporal.gemspec +1 -1
- data/spec/bitemporal_date_spec.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7c7f5e2047c457a89ed6be9bb453988def0043e
|
4
|
+
data.tar.gz: d54425b6efc1010a6fa07db20b0fd0d4047d7340
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc85f0136dc75bb62f85bfde64390a7709eb091c030829888b86e7cf4449681d59b29ced93cdcbd4939f271718abd5ff9c5ff05a451b0fb3124e1bb2419b70d0
|
7
|
+
data.tar.gz: ae9991450de419171deb5687c4d75e00257427e786a7dd5caf5dbdd79f3e02914d0f9e3ebf58a314adc058dd1729863129514f361cf544f19dac7eca0af44d88
|
data/.travis.yml
CHANGED
@@ -70,6 +70,18 @@ module Sequel
|
|
70
70
|
false
|
71
71
|
end
|
72
72
|
end
|
73
|
+
master.class_eval do
|
74
|
+
def self.current_versions_dataset
|
75
|
+
t = ::Sequel::Plugins::Bitemporal.point_in_time
|
76
|
+
n = ::Sequel::Plugins::Bitemporal.now
|
77
|
+
version_class.where do
|
78
|
+
(created_at <= t) &
|
79
|
+
(Sequel.|({expired_at=>nil}, expired_at > t)) &
|
80
|
+
(valid_from <= n) &
|
81
|
+
(valid_to > n)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
73
85
|
master.one_to_many :versions, class: version, key: :master_id, graph_alias_base: master.versions_alias
|
74
86
|
master.one_to_one :current_version, class: version, key: :master_id, graph_alias_base: master.current_version_alias, :graph_block=>(proc do |j, lj, js|
|
75
87
|
t = ::Sequel::Plugins::Bitemporal.point_in_time
|
@@ -578,4 +590,3 @@ module Sequel
|
|
578
590
|
end
|
579
591
|
end
|
580
592
|
end
|
581
|
-
|
data/sequel_bitemporal.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "sequel_bitemporal"
|
6
|
-
s.version = "0.7.
|
6
|
+
s.version = "0.7.6"
|
7
7
|
s.authors = ["Joseph HALTER", "Jonathan TRON"]
|
8
8
|
s.email = ["joseph.halter@thetalentbox.com", "jonathan.tron@thetalentbox.com"]
|
9
9
|
s.homepage = "https://github.com/TalentBox/sequel_bitemporal"
|
@@ -20,6 +20,14 @@ describe "Sequel::Plugins::Bitemporal" do
|
|
20
20
|
@version_class.plugin :bitemporal, version_class: @master_class
|
21
21
|
}.should raise_error Sequel::Error, "bitemporal plugin requires the following missing columns on version class: master_id, valid_from, valid_to, created_at, expired_at"
|
22
22
|
end
|
23
|
+
it "defines current_versions_dataset" do
|
24
|
+
@master_class.new.
|
25
|
+
update_attributes(name: "Single Standard", price: 98).
|
26
|
+
update_attributes(name: "King Size")
|
27
|
+
versions = @master_class.current_versions_dataset.all
|
28
|
+
versions.should have(1).version
|
29
|
+
versions[0].name.should == "King Size"
|
30
|
+
end
|
23
31
|
it "propagates errors from version to master" do
|
24
32
|
master = @master_class.new
|
25
33
|
master.should be_valid
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel_bitemporal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joseph HALTER
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sequel
|