upsert 1.1.4 → 1.1.5
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.
- data/CHANGELOG +6 -0
- data/lib/upsert/column_definition.rb +5 -1
- data/lib/upsert/version.rb +1 -1
- data/spec/spec_helper.rb +3 -0
- data/spec/timezones_spec.rb +9 -0
- metadata +2 -2
data/CHANGELOG
CHANGED
@@ -40,7 +40,11 @@ class Upsert
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def to_selector
|
43
|
-
|
43
|
+
if temporal?
|
44
|
+
"#{quoted_name} = CAST(#{quoted_selector_name} AS #{sql_type})"
|
45
|
+
else
|
46
|
+
"#{quoted_name} = #{quoted_selector_name}"
|
47
|
+
end
|
44
48
|
end
|
45
49
|
|
46
50
|
def temporal?
|
data/lib/upsert/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -100,6 +100,9 @@ class Pet < ActiveRecord::Base
|
|
100
100
|
col :tag_number, :type => :integer
|
101
101
|
col :birthday, :type => :date
|
102
102
|
col :home_address, :type => :text
|
103
|
+
if ENV['DB'] == 'postgresql'
|
104
|
+
col :tsntz, :type => 'timestamp without time zone'
|
105
|
+
end
|
103
106
|
add_index :name, :unique => true
|
104
107
|
end
|
105
108
|
Pet.auto_upgrade!
|
data/spec/timezones_spec.rb
CHANGED
@@ -45,5 +45,14 @@ describe Upsert do
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
if ENV['DB'] == 'postgresql'
|
49
|
+
it "doesn't die on timestamp without time zone (postgresql)" do
|
50
|
+
time = Time.new.utc
|
51
|
+
upsert = Upsert.new $conn, :pets
|
52
|
+
assert_creates(Pet, [[{:name => 'Jerry'}, {:tsntz => time}]]) do
|
53
|
+
upsert.row({:name => 'Jerry'}, {:tsntz => time})
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
48
57
|
end
|
49
58
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upsert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec-core
|