upsert 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 1.1.5 / 2012-12-10
2
+
3
+ * Bug fixes
4
+
5
+ * Properly cast "timestamp without time zone" in postgres - thanks @markmarijnissen! https://github.com/seamusabshere/upsert/issues/11
6
+
1
7
  1.1.4 / 2012-12-06
2
8
 
3
9
  * Enhancements
@@ -40,7 +40,11 @@ class Upsert
40
40
  end
41
41
 
42
42
  def to_selector
43
- "#{quoted_name} = #{quoted_selector_name}"
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?
@@ -1,3 +1,3 @@
1
1
  class Upsert
2
- VERSION = "1.1.4"
2
+ VERSION = "1.1.5"
3
3
  end
@@ -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!
@@ -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
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-07 00:00:00.000000000 Z
12
+ date: 2012-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec-core